]>
git.saurik.com Git - wxWidgets.git/blob - wxPython/demo/CheckBox.py
4 #---------------------------------------------------------------------------
6 class TestCheckBox(wx
.Panel
):
7 def __init__(self
, parent
, log
):
9 wx
.Panel
.__init
__(self
, parent
, -1)
11 wx
.StaticText(self
, -1, "This example uses the wxCheckBox control.", (10, 10))
13 cb1
= wx
.CheckBox(self
, -1, " Apples", (65, 40), (150, 20), wx
.NO_BORDER
)
14 cb2
= wx
.CheckBox(self
, -1, " Oranges", (65, 60), (150, 20), wx
.NO_BORDER
)
16 cb3
= wx
.CheckBox(self
, -1, " Pears", (65, 80), (150, 20), wx
.NO_BORDER
)
18 self
.Bind(wx
.EVT_CHECKBOX
, self
.EvtCheckBox
, cb1
)
19 self
.Bind(wx
.EVT_CHECKBOX
, self
.EvtCheckBox
, cb2
)
20 self
.Bind(wx
.EVT_CHECKBOX
, self
.EvtCheckBox
, cb3
)
22 def EvtCheckBox(self
, event
):
23 self
.log
.WriteText('EvtCheckBox: %d\n' % event
.IsChecked())
25 #---------------------------------------------------------------------------
27 def runTest(frame
, nb
, log
):
28 win
= TestCheckBox(nb
, log
)
31 #---------------------------------------------------------------------------
35 A checkbox is a labelled box which is either on (checkmark is visible) or off
40 #---------------------------------------------------------------------------
42 if __name__
== '__main__':
45 run
.main(['', os
.path
.basename(sys
.argv
[0])] + sys
.argv
[1:])