X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/2f643d0600980076e063ac4937fc8a865b60eea1..c66068835ecce0a507f3e4aa1e21fa05ffdb5049:/wxPython/wx/lib/buttons.py diff --git a/wxPython/wx/lib/buttons.py b/wxPython/wx/lib/buttons.py index efb71b8e8a..11c3e77860 100644 --- a/wxPython/wx/lib/buttons.py +++ b/wxPython/wx/lib/buttons.py @@ -262,7 +262,7 @@ class GenButton(wx.PyControl): x2 = width-1 y2 = height-1 - dc = wx.BufferedPaintDC(self) + dc = wx.PaintDC(self) brush = None if self.up: @@ -312,8 +312,9 @@ class GenButton(wx.PyControl): if not self.up: # if the button was down when the mouse was released... self.Notify() self.up = True - self.Refresh() - event.Skip() + if self: # in case the button was destroyed in the eventhandler + self.Refresh() + event.Skip() def OnMotion(self, event): @@ -346,14 +347,14 @@ class GenButton(wx.PyControl): def OnKeyDown(self, event): - if self.hasFocus and event.KeyCode() == ord(" "): + if self.hasFocus and event.GetKeyCode() == ord(" "): self.up = False self.Refresh() event.Skip() def OnKeyUp(self, event): - if self.hasFocus and event.KeyCode() == ord(" "): + if self.hasFocus and event.GetKeyCode() == ord(" "): self.up = True self.Notify() self.Refresh() @@ -550,7 +551,7 @@ class __ToggleMixin: event.Skip() def OnKeyUp(self, event): - if self.hasFocus and event.KeyCode() == ord(" "): + if self.hasFocus and event.GetKeyCode() == ord(" "): self.up = not self.up self.Notify() self.Refresh()