]> git.saurik.com Git - wxWidgets.git/blame - wxPython/demo/wxRadioBox.py
cleaned up the checkbox creation code (~70 lines of code became 3)
[wxWidgets.git] / wxPython / demo / wxRadioBox.py
CommitLineData
cf694132
RD
1
2from wxPython.wx import *
3
4#---------------------------------------------------------------------------
5
6class TestRadioButtons(wxPanel):
7 def __init__(self, parent, log):
8 self.log = log
9 wxPanel.__init__(self, parent, -1)
eec92d76 10 #self.SetBackgroundColour(wxBLUE)
cf694132
RD
11
12 sampleList = ['zero', 'one', 'two', 'three', 'four', 'five',
13 'six', 'seven', 'eight']
14
15 rb = wxRadioBox(self, 30, "wxRadioBox", wxPoint(35, 30), wxDefaultSize,
8bf5d46e
RD
16 sampleList, 3, wxRA_SPECIFY_COLS)
17 EVT_RADIOBOX(self, 30, self.EvtRadioBox)
eec92d76
RD
18 #rb.SetBackgroundColour(wxBLUE)
19 rb.SetToolTip(wxToolTip("This is a ToolTip!"))
8bf5d46e 20
eec92d76
RD
21 wxRadioButton(self, 32, "wxRadioButton", (235, 35))
22 wxRadioButton(self, 33, "wxRadioButton", (235, 55))
4268f798
RD
23 EVT_RADIOBUTTON(self, 32, self.EvtRadioButton)
24 EVT_RADIOBUTTON(self, 33, self.EvtRadioButton)
8bf5d46e 25
eec92d76 26 rb = wxRadioBox(self, 35, "", wxPoint(35, 120), wxDefaultSize,
cf694132 27 sampleList, 3, wxRA_SPECIFY_COLS | wxNO_BORDER)
eec92d76 28 EVT_RADIOBOX(self, 35, self.EvtRadioBox)
cf694132
RD
29
30
31 def EvtRadioBox(self, event):
32 self.log.WriteText('EvtRadioBox: %d\n' % event.GetInt())
33
4268f798
RD
34 def EvtRadioButton(self, event):
35 self.log.write('EvtRadioButton:%d\n' % event.GetInt())
36
cf694132
RD
37#---------------------------------------------------------------------------
38
39def runTest(frame, nb, log):
40 win = TestRadioButtons(nb, log)
41 return win
42
43#---------------------------------------------------------------------------
44
45
46
47
48
49
50
51
52
53
54
55overview = """\
56A radio box item is used to select one of number of mutually exclusive choices. It is displayed as a vertical column or horizontal row of labelled buttons.
57
493f1553 58"""
cf694132 59
cf694132 60