]> git.saurik.com Git - wxWidgets.git/blame - wxPython/demo/wxToggleButton.py
Added sizer.h
[wxWidgets.git] / wxPython / demo / wxToggleButton.py
CommitLineData
d1679124
RD
1
2from wxPython.wx import *
3
4#----------------------------------------------------------------------
5
6class 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
27def runTest(frame, nb, log):
28 win = TestPanel(nb, log)
29 return win
30
31
32#----------------------------------------------------------------------
33
34
35overview = """\
36"""