]>
git.saurik.com Git - wxWidgets.git/blob - wxPython/demo/wxToggleButton.py
2 from wxPython
.wx
import *
4 #----------------------------------------------------------------------
6 class TestPanel(wxPanel
):
7 def __init__(self
, parent
, log
):
8 wxPanel
.__init
__(self
, parent
, -1)
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)
17 panel
.SetAutoLayout(true
)
18 panel
.SetSizer(buttons
)
22 def OnToggle(self
, evt
):
23 self
.log
.write("Button %d toggled\n" % evt
.GetId())
25 #----------------------------------------------------------------------
27 def runTest(frame
, nb
, log
):
28 win
= TestPanel(nb
, log
)
32 #----------------------------------------------------------------------