X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/969d9b6fa963c0f14298e0ec8aa88b6d6292a6f8..0a5bb138a71dfc1c706fc0858fb2801500e2c2e8:/wxPython/wx/lib/statbmp.py?ds=sidebyside diff --git a/wxPython/wx/lib/statbmp.py b/wxPython/wx/lib/statbmp.py index f0e0ff488c..3585446ee6 100644 --- a/wxPython/wx/lib/statbmp.py +++ b/wxPython/wx/lib/statbmp.py @@ -21,11 +21,13 @@ class GenStaticBitmap(wx.PyControl): 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.SetInitialSize(size) self.Bind(wx.EVT_ERASE_BACKGROUND, self.OnEraseBackground) self.Bind(wx.EVT_PAINT, self.OnPaint) @@ -33,7 +35,7 @@ class GenStaticBitmap(wx.PyControl): def SetBitmap(self, bitmap): self._bitmap = bitmap - self.SetBestSize( (bitmap.GetWidth(), bitmap.GetHeight()) ) + self.SetInitialSize( (bitmap.GetWidth(), bitmap.GetHeight()) ) self.Refresh() @@ -72,7 +74,8 @@ class GenStaticBitmap(wx.PyControl): 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):