]> git.saurik.com Git - wxWidgets.git/blame - utils/wxPython/demo/wxCheckBox.py
Added some test code...
[wxWidgets.git] / utils / wxPython / demo / wxCheckBox.py
CommitLineData
cf694132
RD
1
2from wxPython.wx import *
3
4#---------------------------------------------------------------------------
5
6class TestCheckBox(wxPanel):
7 def __init__(self, parent, log):
8 self.log = log
9 wxPanel.__init__(self, parent, -1)
10
11 wxStaticText(self, -1, "This example uses the wxCheckBox control.",
12 wxPoint(10, 10))
13
14 cID = NewId()
15 cb1 = wxCheckBox(self, cID, " Apples", wxPoint(65, 40), wxSize(150, 20), wxNO_BORDER)
16 cb2 = wxCheckBox(self, cID+1, " Oranges", wxPoint(65, 60), wxSize(150, 20), wxNO_BORDER)
17 cb2.SetValue(true)
18 cb3 = wxCheckBox(self, cID+2, " Pears", wxPoint(65, 80), wxSize(150, 20), wxNO_BORDER)
19
20 EVT_CHECKBOX(self, cID, self.EvtCheckBox)
21 EVT_CHECKBOX(self, cID+1, self.EvtCheckBox)
22 EVT_CHECKBOX(self, cID+2, self.EvtCheckBox)
23
24
25 def EvtCheckBox(self, event):
26 self.log.WriteText('EvtCheckBox: %d\n' % event.Checked())
27
28#---------------------------------------------------------------------------
29
30def runTest(frame, nb, log):
31 win = TestCheckBox(nb, log)
32 return win
33
34#---------------------------------------------------------------------------
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50overview = """\
51A checkbox is a labelled box which is either on (checkmark is visible) or off (no checkmark).
52
53wxCheckBox()
54-----------------------
55
56Default constructor.
57
58wxCheckBox(wxWindow* parent, wxWindowID id, const wxString& label, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = 0, const wxValidator& val, const wxString& name = "checkBox")
59
60Constructor, creating and showing a checkbox.
61
62Parameters
63-------------------
64
65parent = Parent window. Must not be NULL.
66
67id = Checkbox identifier. A value of -1 indicates a default value.
68
69label = Text to be displayed next to the checkbox.
70
71pos = Checkbox position. If the position (-1, -1) is specified then a default position is chosen.
72
73size = Checkbox size. If the default size (-1, -1) is specified then a default size is chosen.
74
75style = Window style. See wxCheckBox.
76
77validator = Window validator.
78
79name = Window name.
80"""