pos = wx.DefaultPosition, size = wx.DefaultSize,
style = 0,
name = "genstatbmp"):
- wx.PyControl.__init__(self, parent, ID, pos, size, style|wx.NO_BORDER,
+ if not style & wx.BORDER_MASK:
+ style = style | wx.BORDER_NONE
+ wx.PyControl.__init__(self, parent, ID, pos, size, style,
wx.DefaultValidator, name)
self._bitmap = bitmap
self.InheritAttributes()
- self.SetBestSize(size)
+ self.SetBestFittingSize(size)
self.Bind(wx.EVT_ERASE_BACKGROUND, self.OnEraseBackground)
self.Bind(wx.EVT_PAINT, self.OnPaint)
def SetBitmap(self, bitmap):
self._bitmap = bitmap
- self.SetBestSize( (bitmap.GetWidth(), bitmap.GetHeight()) )
+ self.SetBestFittingSize( (bitmap.GetWidth(), bitmap.GetHeight()) )
self.Refresh()
def OnPaint(self, event):
dc = wx.PaintDC(self)
- dc.DrawBitmap(self._bitmap, 0, 0, True)
+ if self._bitmap:
+ dc.DrawBitmap(self._bitmap, 0, 0, True)
def OnEraseBackground(self, event):