try calling this function:
self.AlignHorizonalCenter()
in the body of the if statement.
It should look like this:
if self.toolTipWidth < textWidth:
self.toolTipWidth = textWidth
self.AlignHorizonalCenter()
Let me know if it works
This function is ok for alignment, but the width of the tooltip will be generated according to the 'Title' text length and if the title text is too short, some longer bonus texts will get out of the tooltip. I tried to set the tooltip width using the longest text but no result so far. Any ideas?