def __init__(self, parent, background='black', style=0, *args, **kwargs):
"""Initialize a new DrawablePanel.
Args:
parent: wx parent object.
style: Style arguments passed the the wx.Panel base class.
The wx.NO_FULL_REPAINT_ON_RESIZE argument is added
to the given style arguments.
args, kwargs: Additional arguments passed to the wx.Panel
base class.
"""
wx.Panel.__init__(self, parent=parent, style=style | wx.NO_FULL_REPAINT_ON_RESIZE,
*args, **kwargs)
self.background = background
self.lastSize = (0,0)
# initial resize creates initial drawing
# buffer and triggers first draw
self.resize()
self.Bind(wx.EVT_PAINT, self.repaint)
self.Bind(wx.EVT_SIZE, self.resize)
评论列表
文章目录