| 1 | |
| 2 | from wxPython.wx import * |
| 3 | |
| 4 | #--------------------------------------------------------------------------- |
| 5 | |
| 6 | class TestRadioButtons(wxPanel): |
| 7 | def __init__(self, parent, log): |
| 8 | self.log = log |
| 9 | wxPanel.__init__(self, parent, -1) |
| 10 | #self.SetBackgroundColour(wxBLUE) |
| 11 | |
| 12 | sampleList = ['zero', 'one', 'two', 'three', 'four', 'five', |
| 13 | 'six', 'seven', 'eight'] |
| 14 | |
| 15 | rb = wxRadioBox(self, 30, "wxRadioBox", wxPoint(35, 30), wxDefaultSize, |
| 16 | sampleList, 3, wxRA_SPECIFY_COLS) |
| 17 | EVT_RADIOBOX(self, 30, self.EvtRadioBox) |
| 18 | #rb.SetBackgroundColour(wxBLUE) |
| 19 | rb.SetToolTip(wxToolTip("This is a ToolTip!")) |
| 20 | |
| 21 | wxRadioButton(self, 32, "wxRadioButton", (235, 35)) |
| 22 | wxRadioButton(self, 33, "wxRadioButton", (235, 55)) |
| 23 | |
| 24 | rb = wxRadioBox(self, 35, "", wxPoint(35, 120), wxDefaultSize, |
| 25 | sampleList, 3, wxRA_SPECIFY_COLS | wxNO_BORDER) |
| 26 | EVT_RADIOBOX(self, 35, self.EvtRadioBox) |
| 27 | |
| 28 | |
| 29 | def EvtRadioBox(self, event): |
| 30 | self.log.WriteText('EvtRadioBox: %d\n' % event.GetInt()) |
| 31 | |
| 32 | #--------------------------------------------------------------------------- |
| 33 | |
| 34 | def runTest(frame, nb, log): |
| 35 | win = TestRadioButtons(nb, log) |
| 36 | return win |
| 37 | |
| 38 | #--------------------------------------------------------------------------- |
| 39 | |
| 40 | |
| 41 | |
| 42 | |
| 43 | |
| 44 | |
| 45 | |
| 46 | |
| 47 | |
| 48 | |
| 49 | |
| 50 | overview = """\ |
| 51 | 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. |
| 52 | |
| 53 | wxRadioBox() |
| 54 | ---------------------- |
| 55 | |
| 56 | Default constructor. |
| 57 | |
| 58 | wxRadioBox(wxWindow* parent, wxWindowID id, const wxString& label, const wxPoint& point = wxDefaultPosition, const wxSize& size = wxDefaultSize, int n = 0, const wxString choices[] = NULL, int majorDimension = 0, long style = wxRA_SPECIFY_COLS, const wxValidator& validator = wxDefaultValidator, const wxString& name = "radioBox") |
| 59 | |
| 60 | Constructor, creating and showing a radiobox. |
| 61 | |
| 62 | Parameters |
| 63 | ------------------- |
| 64 | |
| 65 | parent = Parent window. Must not be NULL. |
| 66 | |
| 67 | id = Window identifier. A value of -1 indicates a default value. |
| 68 | |
| 69 | label = Label for the static box surrounding the radio buttons. |
| 70 | |
| 71 | pos = Window position. If the position (-1, -1) is specified then a default position is chosen. |
| 72 | |
| 73 | size = Window size. If the default size (-1, -1) is specified then a default size is chosen. |
| 74 | |
| 75 | n = Number of choices with which to initialize the radiobox. |
| 76 | |
| 77 | choices = An array of choices with which to initialize the radiobox. |
| 78 | |
| 79 | majorDimension = Specifies the maximum number of rows (if style contains wxRA_SPECIFY_ROWS) or columns (if style contains wxRA_SPECIFY_COLS) for a two-dimensional radiobox. |
| 80 | |
| 81 | style = Window style. See wxRadioBox. |
| 82 | |
| 83 | validator = Window validator. |
| 84 | |
| 85 | name = Window name. |
| 86 | """ |