]> git.saurik.com Git - wxWidgets.git/blame - wxPython/demo/wxRadioBox.py
fix Union(empty rect) bug
[wxWidgets.git] / wxPython / demo / wxRadioBox.py
CommitLineData
cf694132
RD
1
2from wxPython.wx import *
3
4#---------------------------------------------------------------------------
5
eb0f373c
RD
6RBOX1 = wxNewId()
7RBOX2 = wxNewId()
8RBUT1 = wxNewId()
9RBUT2 = wxNewId()
10
cf694132
RD
11class TestRadioButtons(wxPanel):
12 def __init__(self, parent, log):
13 self.log = log
14 wxPanel.__init__(self, parent, -1)
eec92d76 15 #self.SetBackgroundColour(wxBLUE)
cf694132
RD
16
17 sampleList = ['zero', 'one', 'two', 'three', 'four', 'five',
18 'six', 'seven', 'eight']
19
eb0f373c
RD
20 sizer = wxBoxSizer(wxVERTICAL)
21 rb = wxRadioBox(self, RBOX1, "wxRadioBox",
22 wxDefaultPosition, wxDefaultSize,
23 sampleList, 2, wxRA_SPECIFY_COLS)
24 EVT_RADIOBOX(self, RBOX1, self.EvtRadioBox)
eec92d76
RD
25 #rb.SetBackgroundColour(wxBLUE)
26 rb.SetToolTip(wxToolTip("This is a ToolTip!"))
eb0f373c
RD
27 #rb.SetLabel("wxRadioBox")
28 sizer.Add(rb, 0, wxALL, 20)
8bf5d46e 29
eb0f373c 30 rb = wxRadioBox(self, RBOX2, "", wxDefaultPosition, wxDefaultSize,
cf694132 31 sampleList, 3, wxRA_SPECIFY_COLS | wxNO_BORDER)
eb0f373c
RD
32 EVT_RADIOBOX(self, RBOX2, self.EvtRadioBox)
33 rb.SetToolTip(wxToolTip("This box has no label"))
34 sizer.Add(rb, 0, wxLEFT|wxRIGHT|wxBOTTOM, 20)
35
36 sizer.Add(wxStaticText(self, -1, "These are plain wxRadioButtons"),
37 0, wxLEFT|wxRIGHT, 20)
38 sizer.Add(wxRadioButton(self, RBUT1, "wxRadioButton 1"),
39 0, wxLEFT|wxRIGHT, 20)
40 sizer.Add(wxRadioButton(self, RBUT2, "wxRadioButton 2"),
41 0, wxLEFT|wxRIGHT, 20)
42 EVT_RADIOBUTTON(self, RBUT1, self.EvtRadioButton)
43 EVT_RADIOBUTTON(self, RBUT2, self.EvtRadioButton)
44
45 self.SetSizer(sizer)
cf694132
RD
46
47
48 def EvtRadioBox(self, event):
49 self.log.WriteText('EvtRadioBox: %d\n' % event.GetInt())
50
4268f798
RD
51 def EvtRadioButton(self, event):
52 self.log.write('EvtRadioButton:%d\n' % event.GetInt())
53
cf694132
RD
54#---------------------------------------------------------------------------
55
56def runTest(frame, nb, log):
57 win = TestRadioButtons(nb, log)
58 return win
59
60#---------------------------------------------------------------------------
61
62
63
64
65
66
67
68
69
70
71
72overview = """\
73A 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.
74
493f1553 75"""
cf694132 76
cf694132 77