]>
Commit | Line | Data |
---|---|---|
1 | ||
2 | import wx | |
3 | ||
4 | #--------------------------------------------------------------------------- | |
5 | ||
6 | class TestRadioBox(wx.Panel): | |
7 | def __init__(self, parent, log): | |
8 | self.log = log | |
9 | wx.Panel.__init__(self, parent, -1) | |
10 | #self.SetBackgroundColour(wx.BLUE) | |
11 | ||
12 | sampleList = ['zero', 'one', 'two', 'three', 'four', 'five', | |
13 | 'six', 'seven', 'eight'] | |
14 | ||
15 | sizer = wx.BoxSizer(wx.VERTICAL) | |
16 | ||
17 | rb = wx.RadioBox( | |
18 | self, -1, "wx.RadioBox", wx.DefaultPosition, wx.DefaultSize, | |
19 | sampleList, 2, wx.RA_SPECIFY_COLS | |
20 | ) | |
21 | ||
22 | self.Bind(wx.EVT_RADIOBOX, self.EvtRadioBox, rb) | |
23 | #rb.SetBackgroundColour(wx.BLUE) | |
24 | rb.SetToolTip(wx.ToolTip("This is a ToolTip!")) | |
25 | #rb.SetLabel("wx.RadioBox") | |
26 | ||
27 | sizer.Add(rb, 0, wx.ALL, 20) | |
28 | ||
29 | rb = wx.RadioBox( | |
30 | self, -1, "", wx.DefaultPosition, wx.DefaultSize, | |
31 | sampleList, 3, wx.RA_SPECIFY_COLS | wx.NO_BORDER | |
32 | ) | |
33 | ||
34 | self.Bind(wx.EVT_RADIOBOX, self.EvtRadioBox, rb) | |
35 | rb.SetToolTip(wx.ToolTip("This box has no label")) | |
36 | ||
37 | sizer.Add(rb, 0, wx.LEFT|wx.RIGHT|wx.BOTTOM, 20) | |
38 | ||
39 | self.SetSizer(sizer) | |
40 | ||
41 | ||
42 | def EvtRadioBox(self, event): | |
43 | self.log.WriteText('EvtRadioBox: %d\n' % event.GetInt()) | |
44 | ||
45 | #--------------------------------------------------------------------------- | |
46 | ||
47 | def runTest(frame, nb, log): | |
48 | win = TestRadioBox(nb, log) | |
49 | return win | |
50 | ||
51 | ||
52 | ||
53 | overview = """\ | |
54 | A RadioBox is used to select one of a number of mutually exclusive | |
55 | choices. It is displayed as a vertical column or horizontal row of | |
56 | labelled buttons, surrounded by a box that can optionally have a | |
57 | label. | |
58 | ||
59 | """ | |
60 | ||
61 | ||
62 | if __name__ == '__main__': | |
63 | import sys,os | |
64 | import run | |
65 | run.main(['', os.path.basename(sys.argv[0])] + sys.argv[1:]) | |
66 |