]>
git.saurik.com Git - wxWidgets.git/blob - wxPython/demo/CheckBox.py
1 # 11/15/2003 - Jeff Grimmett (grimmtooth@softhome.net)
3 # o Updated for wx namespace
8 #---------------------------------------------------------------------------
10 class TestCheckBox(wx
.Panel
):
11 def __init__(self
, parent
, log
):
13 wx
.Panel
.__init
__(self
, parent
, -1)
15 wx
.StaticText(self
, -1, "This example uses the wxCheckBox control.", (10, 10))
18 cb1
= wx
.CheckBox(self
, cID
, " Apples", (65, 40), (150, 20), wx
.NO_BORDER
)
19 cb2
= wx
.CheckBox(self
, cID
+1, " Oranges", (65, 60), (150, 20), wx
.NO_BORDER
)
21 cb3
= wx
.CheckBox(self
, cID
+2, " Pears", (65, 80), (150, 20), wx
.NO_BORDER
)
23 self
.Bind(wx
.EVT_CHECKBOX
, self
.EvtCheckBox
, cb1
)
24 self
.Bind(wx
.EVT_CHECKBOX
, self
.EvtCheckBox
, cb2
)
25 self
.Bind(wx
.EVT_CHECKBOX
, self
.EvtCheckBox
, cb3
)
27 def EvtCheckBox(self
, event
):
28 self
.log
.WriteText('EvtCheckBox: %d\n' % event
.IsChecked())
30 #---------------------------------------------------------------------------
32 def runTest(frame
, nb
, log
):
33 win
= TestCheckBox(nb
, log
)
36 #---------------------------------------------------------------------------
43 A checkbox is a labelled box which is either on (checkmark is visible) or off (no checkmark).
49 if __name__
== '__main__':
52 run
.main(['', os
.path
.basename(sys
.argv
[0])])