]>
git.saurik.com Git - wxWidgets.git/blob - utils/wxPython/demo/wxCheckBox.py
2 from wxPython
.wx
import *
4 #---------------------------------------------------------------------------
6 class TestCheckBox(wxPanel
):
7 def __init__(self
, parent
, log
):
9 wxPanel
.__init
__(self
, parent
, -1)
11 wxStaticText(self
, -1, "This example uses the wxCheckBox control.",
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
)
18 cb3
= wxCheckBox(self
, cID
+2, " Pears", wxPoint(65, 80), wxSize(150, 20), wxNO_BORDER
)
20 EVT_CHECKBOX(self
, cID
, self
.EvtCheckBox
)
21 EVT_CHECKBOX(self
, cID
+1, self
.EvtCheckBox
)
22 EVT_CHECKBOX(self
, cID
+2, self
.EvtCheckBox
)
25 def EvtCheckBox(self
, event
):
26 self
.log
.WriteText('EvtCheckBox: %d\n' % event
.Checked())
28 #---------------------------------------------------------------------------
30 def runTest(frame
, nb
, log
):
31 win
= TestCheckBox(nb
, log
)
34 #---------------------------------------------------------------------------
51 A checkbox is a labelled box which is either on (checkmark is visible) or off (no checkmark).
54 -----------------------
58 wxCheckBox(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")
60 Constructor, creating and showing a checkbox.
65 parent = Parent window. Must not be NULL.
67 id = Checkbox identifier. A value of -1 indicates a default value.
69 label = Text to be displayed next to the checkbox.
71 pos = Checkbox position. If the position (-1, -1) is specified then a default position is chosen.
73 size = Checkbox size. If the default size (-1, -1) is specified then a default size is chosen.
75 style = Window style. See wxCheckBox.
77 validator = Window validator.