]>
Commit | Line | Data |
---|---|---|
1 | ||
2 | from wxPython.wx import * | |
3 | ||
4 | #--------------------------------------------------------------------------- | |
5 | ||
6 | RBUT1 = wxNewId() | |
7 | RBUT2 = wxNewId() | |
8 | RBUT3 = wxNewId() | |
9 | RBUT4 = wxNewId() | |
10 | ||
11 | RBOX1 = wxNewId() | |
12 | RBOX2 = wxNewId() | |
13 | ||
14 | class 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 | ||
50 | def runTest(frame, nb, log): | |
51 | win = TestRadioButtons(nb, log) | |
52 | return win | |
53 | ||
54 | ||
55 | ||
56 | overview = """\ | |
57 | A radio box item is used to select one of number of mutually exclusive | |
58 | choices. It is displayed as a vertical column or horizontal row of | |
59 | labelled buttons. | |
60 | ||
61 | """ | |
62 | ||
63 | ||
64 | ||
65 | if __name__ == '__main__': | |
66 | import sys,os | |
67 | import run | |
68 | run.main(['', os.path.basename(sys.argv[0])]) | |
69 |