]> git.saurik.com Git - wxWidgets.git/blame_incremental - wxPython/demo/wxRadioBox.py
fix text scrolling in GTK2 (patch 703988)
[wxWidgets.git] / wxPython / demo / wxRadioBox.py
... / ...
CommitLineData
1
2from wxPython.wx import *
3
4#---------------------------------------------------------------------------
5
6RBUT1 = wxNewId()
7RBUT2 = wxNewId()
8RBUT3 = wxNewId()
9RBUT4 = wxNewId()
10
11RBOX1 = wxNewId()
12RBOX2 = wxNewId()
13
14class TestRadioButtons(wxPanel):
15 def __init__(self, parent, log):
16 self.log = log
17 wxPanel.__init__(self, parent, -1)
18 #self.SetBackgroundColour(wxBLUE)
19
20 sampleList = ['zero', 'one', 'two', 'three', 'four', 'five',
21 'six', 'seven', 'eight']
22
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)
28 #rb.SetBackgroundColour(wxBLUE)
29 rb.SetToolTip(wxToolTip("This is a ToolTip!"))
30 #rb.SetLabel("wxRadioBox")
31 sizer.Add(rb, 0, wxALL, 20)
32
33 rb = wxRadioBox(self, RBOX2, "", wxDefaultPosition, wxDefaultSize,
34 sampleList, 3, wxRA_SPECIFY_COLS | wxNO_BORDER)
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
39 self.SetSizer(sizer)
40
41
42 def EvtRadioBox(self, event):
43 self.log.WriteText('EvtRadioBox: %d\n' % event.GetInt())
44
45 def EvtRadioButton(self, event):
46 self.log.write('EvtRadioButton:%d\n' % event.GetId())
47
48#---------------------------------------------------------------------------
49
50def runTest(frame, nb, log):
51 win = TestRadioButtons(nb, log)
52 return win
53
54
55
56overview = """\
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.
60
61"""
62
63
64
65if __name__ == '__main__':
66 import sys,os
67 import run
68 run.main(['', os.path.basename(sys.argv[0])])
69