def OnPaint(self, event):
"""
Callback for Paint Event
@param event: Paint event
"""
# Get buffered paint DC for tool tip
dc = wx.AutoBufferedPaintDC(self)
dc.Clear()
# Set DC drawing style
dc.SetPen(wx.BLACK_PEN)
dc.SetBrush(wx.Brush(wx.Colour(255, 238, 170)))
dc.SetFont(self.Font)
# Draw Tool tip
dc.BeginDrawing()
tip_width, tip_height = self.GetToolTipSize()
# Draw background rectangle
dc.DrawRectangle(0, 0, tip_width, tip_height)
# Draw tool tip text
line_offset = 0
for line in self.Tip:
dc.DrawText(line, 2, line_offset + 2)
line_width, line_height = dc.GetTextExtent(line)
line_offset += line_height
dc.EndDrawing()
event.Skip()
评论列表
文章目录