From fbff5d1ba5c7d696bb429715bf0c339dd0bb425b Mon Sep 17 00:00:00 2001 From: Robin Dunn Date: Sat, 11 Dec 1999 08:09:25 +0000 Subject: [PATCH] One more quickie git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@4901 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- utils/wxPython/demo/GenericButtons.py | 1 + utils/wxPython/lib/buttons.py | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/utils/wxPython/demo/GenericButtons.py b/utils/wxPython/demo/GenericButtons.py index e069d7ec52..726874eea0 100644 --- a/utils/wxPython/demo/GenericButtons.py +++ b/utils/wxPython/demo/GenericButtons.py @@ -64,6 +64,7 @@ class TestPanel(wxPanel): mask = wxMaskColour(bmp, wxBLUE) bmp.SetMask(mask) b.SetBitmapSelected(bmp) + b.SetToggle(true) def OnButton(self, event): diff --git a/utils/wxPython/lib/buttons.py b/utils/wxPython/lib/buttons.py index e9864d1137..ed1a381cfa 100644 --- a/utils/wxPython/lib/buttons.py +++ b/utils/wxPython/lib/buttons.py @@ -303,6 +303,12 @@ class wxGenBitmapButton(wxGenButton): class __ToggleMixin: + def SetToggle(self, flag): + self.up = not flag + + def GetToggle(self): + return not self.up + def OnLeftDown(self, event): if not self.IsEnabled(): return @@ -329,6 +335,8 @@ class __ToggleMixin: event.Skip() + + class wxGenToggleButton(__ToggleMixin, wxGenButton): pass -- 2.45.2