]>
Commit | Line | Data |
---|---|---|
cf694132 | 1 | |
8fa876ca | 2 | import wx |
cf694132 RD |
3 | |
4 | #--------------------------------------------------------------------------- | |
5 | ||
8fa876ca | 6 | class TestRadioBox(wx.Panel): |
cf694132 RD |
7 | def __init__(self, parent, log): |
8 | self.log = log | |
8fa876ca RD |
9 | wx.Panel.__init__(self, parent, -1) |
10 | #self.SetBackgroundColour(wx.BLUE) | |
cf694132 RD |
11 | |
12 | sampleList = ['zero', 'one', 'two', 'three', 'four', 'five', | |
13 | 'six', 'seven', 'eight'] | |
14 | ||
8fa876ca RD |
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!")) | |
95bfd958 | 25 | #rb.SetLabel("wx.RadioBox") |
8bf5d46e | 26 | |
8fa876ca RD |
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) | |
eb0f373c | 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 | ||
45 | #--------------------------------------------------------------------------- | |
46 | ||
47 | def runTest(frame, nb, log): | |
8fa876ca | 48 | win = TestRadioBox(nb, log) |
cf694132 RD |
49 | return win |
50 | ||
cf694132 RD |
51 | |
52 | ||
53 | overview = """\ | |
95bfd958 | 54 | A RadioBox is used to select one of a number of mutually exclusive |
1e4a197e | 55 | choices. It is displayed as a vertical column or horizontal row of |
95bfd958 RD |
56 | labelled buttons, surrounded by a box that can optionally have a |
57 | label. | |
cf694132 | 58 | |
493f1553 | 59 | """ |
cf694132 | 60 | |
cf694132 | 61 | |
1e4a197e RD |
62 | if __name__ == '__main__': |
63 | import sys,os | |
64 | import run | |
65 | run.main(['', os.path.basename(sys.argv[0])]) | |
66 |