1999-04-29 23:29:54 -04:00
|
|
|
|
|
|
|
from wxPython.wx import *
|
|
|
|
|
|
|
|
#---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
class TestCheckBox(wxPanel):
|
|
|
|
def __init__(self, parent, log):
|
|
|
|
self.log = log
|
|
|
|
wxPanel.__init__(self, parent, -1)
|
|
|
|
|
|
|
|
wxStaticText(self, -1, "This example uses the wxCheckBox control.",
|
|
|
|
wxPoint(10, 10))
|
|
|
|
|
2003-07-02 19:13:10 -04:00
|
|
|
cID = wxNewId()
|
1999-04-29 23:29:54 -04:00
|
|
|
cb1 = wxCheckBox(self, cID, " Apples", wxPoint(65, 40), wxSize(150, 20), wxNO_BORDER)
|
|
|
|
cb2 = wxCheckBox(self, cID+1, " Oranges", wxPoint(65, 60), wxSize(150, 20), wxNO_BORDER)
|
2003-03-25 01:35:27 -05:00
|
|
|
cb2.SetValue(True)
|
1999-04-29 23:29:54 -04:00
|
|
|
cb3 = wxCheckBox(self, cID+2, " Pears", wxPoint(65, 80), wxSize(150, 20), wxNO_BORDER)
|
|
|
|
|
|
|
|
EVT_CHECKBOX(self, cID, self.EvtCheckBox)
|
|
|
|
EVT_CHECKBOX(self, cID+1, self.EvtCheckBox)
|
|
|
|
EVT_CHECKBOX(self, cID+2, self.EvtCheckBox)
|
|
|
|
|
|
|
|
|
|
|
|
def EvtCheckBox(self, event):
|
2003-11-12 16:34:20 -05:00
|
|
|
self.log.WriteText('EvtCheckBox: %d\n' % event.IsChecked())
|
1999-04-29 23:29:54 -04:00
|
|
|
|
|
|
|
#---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
def runTest(frame, nb, log):
|
|
|
|
win = TestCheckBox(nb, log)
|
|
|
|
return win
|
|
|
|
|
|
|
|
#---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
overview = """\
|
|
|
|
A checkbox is a labelled box which is either on (checkmark is visible) or off (no checkmark).
|
|
|
|
|
|
|
|
"""
|
2003-07-02 19:13:10 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
import sys,os
|
|
|
|
import run
|
|
|
|
run.main(['', os.path.basename(sys.argv[0])])
|
|
|
|
|