]> git.saurik.com Git - wxWidgets.git/blame - wxPython/demo/wxRadioBox.py
focus setting must be possible even when not shown yet
[wxWidgets.git] / wxPython / demo / wxRadioBox.py
CommitLineData
cf694132
RD
1
2from wxPython.wx import *
3
4#---------------------------------------------------------------------------
5
eb0f373c
RD
6RBUT1 = wxNewId()
7RBUT2 = wxNewId()
1e4a197e
RD
8RBUT3 = wxNewId()
9RBUT4 = wxNewId()
10
11RBOX1 = wxNewId()
12RBOX2 = wxNewId()
eb0f373c 13
cf694132
RD
14class TestRadioButtons(wxPanel):
15 def __init__(self, parent, log):
16 self.log = log
17 wxPanel.__init__(self, parent, -1)
eec92d76 18 #self.SetBackgroundColour(wxBLUE)
cf694132
RD
19
20 sampleList = ['zero', 'one', 'two', 'three', 'four', 'five',
21 'six', 'seven', 'eight']
22
eb0f373c
RD
23 sizer = wxBoxSizer(wxVERTICAL)
24 rb = wxRadioBox(self, RBOX1, "wxRadioBox",
25 wxDefaultPosition, wxDefaultSize,
26 sampleList, 2, wxRA_SPECIFY_COLS)
27 EVT_RADIOBOX(self, RBOX1, self.EvtRadioBox)
eec92d76
RD
28 #rb.SetBackgroundColour(wxBLUE)
29 rb.SetToolTip(wxToolTip("This is a ToolTip!"))
eb0f373c
RD
30 #rb.SetLabel("wxRadioBox")
31 sizer.Add(rb, 0, wxALL, 20)
8bf5d46e 32
eb0f373c 33 rb = wxRadioBox(self, RBOX2, "", wxDefaultPosition, wxDefaultSize,
cf694132 34 sampleList, 3, wxRA_SPECIFY_COLS | wxNO_BORDER)
eb0f373c
RD
35 EVT_RADIOBOX(self, RBOX2, self.EvtRadioBox)
36 rb.SetToolTip(wxToolTip("This box has no label"))
37 sizer.Add(rb, 0, wxLEFT|wxRIGHT|wxBOTTOM, 20)
38
eb0f373c 39 self.SetSizer(sizer)
cf694132
RD
40
41
42 def EvtRadioBox(self, event):
43 self.log.WriteText('EvtRadioBox: %d\n' % event.GetInt())
44
4268f798 45 def EvtRadioButton(self, event):
1e4a197e 46 self.log.write('EvtRadioButton:%d\n' % event.GetId())
4268f798 47
cf694132
RD
48#---------------------------------------------------------------------------
49
50def runTest(frame, nb, log):
51 win = TestRadioButtons(nb, log)
52 return win
53
cf694132
RD
54
55
56overview = """\
1e4a197e
RD
57A radio box item is used to select one of number of mutually exclusive
58choices. It is displayed as a vertical column or horizontal row of
59labelled buttons.
cf694132 60
493f1553 61"""
cf694132 62
cf694132 63
1e4a197e
RD
64
65if __name__ == '__main__':
66 import sys,os
67 import run
68 run.main(['', os.path.basename(sys.argv[0])])
69