- clr = parent.GetForegroundColour()
- if not clr.Ok():
- clr = wx.SystemSettings_GetSystemColour(wx.SYS_COLOUR_BTNTEXT)
- self.SetForegroundColour(clr)
-
- rw, rh = size
- bw, bh = self.GetBestSize()
- if rw == -1: rw = bw
- if rh == -1: rh = bh
- self.SetSize(wx.Size(rw, rh))
-
- wx.EVT_ERASE_BACKGROUND(self, self.OnEraseBackground)
- wx.EVT_PAINT(self, self.OnPaint)
+ self.Bind(wx.EVT_PAINT, self.OnPaint)
+ if BUFFERED:
+ self.defBackClr = self.GetBackgroundColour()
+ self.Bind(wx.EVT_ERASE_BACKGROUND, self.OnEraseBackground)
+ else:
+ self.SetBackgroundStyle(wx.BG_STYLE_SYSTEM)
+