4 #---------------------------------------------------------------------------
6 class TestCheckBox(wx
.Panel
):
7 def __init__(self
, parent
, log
):
9 wx
.Panel
.__init
__(self
, parent
, -1)
11 st
= wx
.StaticText(self
, -1, "This example demonstrates the wx.CheckBox 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 cb4
= wx
.CheckBox(self
, -1, "3-state checkbox",
19 style
=wx
.CHK_3STATE|wx
.CHK_ALLOW_3RD_STATE_FOR_USER
)
20 cb5
= wx
.CheckBox(self
, -1, "Align Right", style
=wx
.ALIGN_RIGHT
)
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
)
26 self
.Bind(wx
.EVT_CHECKBOX
, self
.EvtCheckBox
, cb4
)
27 self
.Bind(wx
.EVT_CHECKBOX
, self
.EvtCheckBox
, cb5
)
29 sizer
= wx
.BoxSizer(wx
.VERTICAL
)
39 border
= wx
.BoxSizer(wx
.VERTICAL
)
40 border
.Add(st
, 0, wx
.ALL
, 15)
41 border
.Add(sizer
, 0, wx
.LEFT
, 50)
45 def EvtCheckBox(self
, event
):
46 self
.log
.write('EvtCheckBox: %d\n' % event
.IsChecked())
47 cb
= event
.GetEventObject()
49 self
.log
.write("\t3StateValue: %s\n" % cb
.Get3StateValue())
52 #---------------------------------------------------------------------------
54 def runTest(frame
, nb
, log
):
55 win
= TestCheckBox(nb
, log
)
58 #---------------------------------------------------------------------------
62 A checkbox is a labelled box which is either on (checkmark is visible) or off
67 #---------------------------------------------------------------------------
69 if __name__
== '__main__':
72 run
.main(['', os
.path
.basename(sys
.argv
[0])] + sys
.argv
[1:])