2 from wxPython
.wx
import *
10 #----------------------------------------------------------------------
12 class TestPanel(wxPanel
):
13 def __init__(self
, parent
, log
):
14 wxPanel
.__init
__(self
, parent
, -1)
16 panel
= wxPanel(self
, -1)
17 buttons
= wxBoxSizer(wxHORIZONTAL
)
18 for word
in "These are toggle buttons".split():
19 b
= wxToggleButton(panel
, -1, word
)
20 EVT_TOGGLEBUTTON(self
, b
.GetId(), self
.OnToggle
)
21 buttons
.Add(b
, flag
=wxALL
, border
=5)
23 panel
.SetAutoLayout(True)
24 panel
.SetSizer(buttons
)
28 def OnToggle(self
, evt
):
29 self
.log
.write("Button %d toggled\n" % evt
.GetId())
31 #----------------------------------------------------------------------
33 def runTest(frame
, nb
, log
):
35 win
= TestPanel(nb
, log
)
38 dlg
= wxMessageDialog(frame
, 'wxToggleButton is not available on this platform.',
39 'Sorry', wxOK | wxICON_INFORMATION
)
46 #----------------------------------------------------------------------
56 if __name__
== '__main__':
59 run
.main(['', os
.path
.basename(sys
.argv
[0])])