]> git.saurik.com Git - wxWidgets.git/blob - wxPython/demo/wxToggleButton.py
cleaned up the checkbox creation code (~70 lines of code became 3)
[wxWidgets.git] / wxPython / demo / wxToggleButton.py
1
2 from wxPython.wx import *
3
4 #----------------------------------------------------------------------
5
6 class TestPanel(wxPanel):
7 def __init__(self, parent, log):
8 wxPanel.__init__(self, parent, -1)
9 self.log = log
10 panel = wxPanel(self, -1)
11 buttons = wxBoxSizer(wxHORIZONTAL)
12 for word in string.split("These are toggle buttons"):
13 b = wxToggleButton(panel, -1, word)
14 EVT_TOGGLEBUTTON(self, b.GetId(), self.OnToggle)
15 buttons.Add(b, flag=wxALL, border=5)
16
17 panel.SetAutoLayout(true)
18 panel.SetSizer(buttons)
19 buttons.Fit(panel)
20 panel.Move((50,50))
21
22 def OnToggle(self, evt):
23 self.log.write("Button %d toggled\n" % evt.GetId())
24
25 #----------------------------------------------------------------------
26
27 def runTest(frame, nb, log):
28 win = TestPanel(nb, log)
29 return win
30
31
32 #----------------------------------------------------------------------
33
34
35 overview = """\
36 """