def GetToolTipSize(self):
"""
Get tool tip size according to tip text and restriction
@return: wx.Size(tool_tip_width, tool_tip_height)
"""
max_width = max_height = 0
# Create a memory DC for calculating text extent
dc = wx.MemoryDC()
dc.SetFont(self.Font)
# Compute max tip text size
for line in self.Tip:
w, h = dc.GetTextExtent(line)
max_width = max(max_width, w)
max_height += h
return wx.Size(max_width + 4, max_height + 4)
评论列表
文章目录