]> git.saurik.com Git - wxWidgets.git/blob - wxPython/demo/wxRadioBox.py
Applied patch [ 549256 ] fix minor bug in widgets sample
[wxWidgets.git] / wxPython / demo / wxRadioBox.py
1
2 from wxPython.wx import *
3
4 #---------------------------------------------------------------------------
5
6 RBOX1 = wxNewId()
7 RBOX2 = wxNewId()
8 RBUT1 = wxNewId()
9 RBUT2 = wxNewId()
10
11 class TestRadioButtons(wxPanel):
12 def __init__(self, parent, log):
13 self.log = log
14 wxPanel.__init__(self, parent, -1)
15 #self.SetBackgroundColour(wxBLUE)
16
17 sampleList = ['zero', 'one', 'two', 'three', 'four', 'five',
18 'six', 'seven', 'eight']
19
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)
25 #rb.SetBackgroundColour(wxBLUE)
26 rb.SetToolTip(wxToolTip("This is a ToolTip!"))
27 #rb.SetLabel("wxRadioBox")
28 sizer.Add(rb, 0, wxALL, 20)
29
30 rb = wxRadioBox(self, RBOX2, "", wxDefaultPosition, wxDefaultSize,
31 sampleList, 3, wxRA_SPECIFY_COLS | wxNO_BORDER)
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)
46
47
48 def EvtRadioBox(self, event):
49 self.log.WriteText('EvtRadioBox: %d\n' % event.GetInt())
50
51 def EvtRadioButton(self, event):
52 self.log.write('EvtRadioButton:%d\n' % event.GetInt())
53
54 #---------------------------------------------------------------------------
55
56 def 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
72 overview = """\
73 A 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
75 """
76
77