wx.RadioBox¶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.
^^
Window Styles¶This class supports the following styles:
wx.RA_SPECIFY_ROWS: The major dimension parameter refers to the maximum number of rows.
wx.RA_SPECIFY_COLS: The major dimension parameter refers to the maximum number of columns. ^^
^^
Events Emitted by this Class¶Handlers bound for the following event types will receive a wx.CommandEvent parameter.
EVT_RADIOBOX: Process a wxEVT_RADIOBOX event, when a radiobutton is clicked. ^^
Class Hierarchy¶
Inheritance diagram for class RadioBox:

Control Appearance¶
wxMSW¶
wxMAC¶
wxGTK¶
Methods Summary¶Default constructor. |
|
Creates the radiobox for two-step construction. |
|
Enables or disables an individual button in the radiobox. |
|
Finds a button matching the given string, returning the position if found, or |
|
Returns the number of columns in the radiobox. |
|
Returns the number of items in the control. |
|
Returns a radio box item under the point, a zero-based item index, or |
|
Returns the helptext associated with the specified item if any or |
|
GetItemLabel(self, n) . string |
|
Returns the tooltip associated with the specified item if any or |
|
Returns the number of rows in the radiobox. |
|
Returns the index of the selected item. |
|
Returns the label of the item with the given index. |
|
Returns |
|
Returns |
|
Sets the helptext for an item. |
|
SetItemLabel(self, n, text) |
|
Sets the tooltip text for the specified item in the radio group. |
|
Sets the selection to the given item. |
|
Sets the label for the given item. |
|
Shows or hides individual buttons. |
Properties Summary¶See |
|
See |
|
See |
|
See |
Class API¶wx.RadioBox(Control, ItemContainerImmutable)¶Possible constructors:
RadioBox()
RadioBox(parent, id=ID_ANY, label="", pos=DefaultPosition,
size=DefaultSize, choices=[], majorDimension=0, style=RA_SPECIFY_COLS,
validator=DefaultValidator, name=RadioBoxNameStr)
A radio box item is used to select one of number of mutually exclusive choices.
__init__(self, *args, **kw)¶__init__ (self)
Default constructor.
See also
__init__ (self, parent, id=ID_ANY, label=””, pos=DefaultPosition, size=DefaultSize, choices=[], majorDimension=0, style=RA_SPECIFY_COLS, validator=DefaultValidator, name=RadioBoxNameStr)
Constructor, creating and showing a radiobox.
parent (wx.Window) – Parent window. Must not be None.
id (wx.WindowID) – Window identifier. The value ID_ANY indicates a default value.
label (string) – Label for the static box surrounding the radio buttons.
pos (wx.Point) – Window position. If wx.DefaultPosition is specified then a default position is chosen.
size (wx.Size) – Window size. If wx.DefaultSize is specified then a default size is chosen.
choices (list of strings) – An array of choices with which to initialize the radiobox.
majorDimension (int) – Specifies the maximum number of rows (if style contains RA_SPECIFY_ROWS ) or columns (if style contains RA_SPECIFY_COLS ) for a two-dimensional radiobox. The default value of 0 means to use the number of items, i.e. number of elements in choices.
style (long) – Window style. See wx.RadioBox.
validator (wx.Validator) – Window validator.
name (string) – Window name.
Create(self, parent, id=ID_ANY, label="", pos=DefaultPosition, size=DefaultSize, choices=[], majorDimension=0, style=RA_SPECIFY_COLS, validator=DefaultValidator, name=RadioBoxNameStr)¶Creates the radiobox for two-step construction.
See wx.RadioBox for further details.
parent (wx.Window) –
id (wx.WindowID) –
label (string) –
pos (wx.Point) –
size (wx.Size) –
choices (list of strings) –
majorDimension (int) –
style (long) –
validator (wx.Validator) –
name (string) –
bool
EnableItem(self, n, enable=True)¶Enables or disables an individual button in the radiobox.
n (int) – The zero-based button to enable or disable.
enable (bool) – True to enable, False to disable.
bool
See also
FindString(self, string, bCase=False)¶Finds a button matching the given string, returning the position if found, or NOT_FOUND if not found.
string (string) – The string to find.
bCase (bool) – Should the search be case-sensitive?
int
GetClassDefaultAttributes(variant=WINDOW_VARIANT_NORMAL)¶variant (WindowVariant) –
GetColumnCount(self)¶Returns the number of columns in the radiobox.
int
GetItemFromPoint(self, pt)¶Returns a radio box item under the point, a zero-based item index, or NOT_FOUND if no item is under the point.
pt (wx.Point) – Point in client coordinates.
int
GetItemHelpText(self, item)¶Returns the helptext associated with the specified item if any or "" .
item (int) – The zero-based item index.
string
See also
GetItemLabel(self, n)¶Return the text of the n’th item in the radio box.
GetItemToolTip(self, item)¶Returns the tooltip associated with the specified item if any or None.
item (int) –
See also
GetRowCount(self)¶Returns the number of rows in the radiobox.
int
GetSelection(self)¶Returns the index of the selected item.
As radio boxes always have a selected item, the return value is never NOT_FOUND for this class.
int
GetString(self, n)¶Returns the label of the item with the given index.
The index must be valid, i.e. less than the value returned by GetCount , otherwise an assert is triggered. Notably, this function can’t be called if the control is empty.
n (int) – The zero-based index.
string
The label of the item.
IsItemEnabled(self, n)¶Returns True if the item is enabled or False if it was disabled using Enable .
This function is currently only implemented in wxMSW, wxGTK, QT and wxUniversal and always returns True in the other ports.
n (int) – The zero-based button position.
bool
IsItemShown(self, n)¶Returns True if the item is currently shown or False if it was hidden using Show .
Note that this function returns True for an item which hadn’t been hidden even if the entire radiobox is not currently shown.
This function is currently only implemented in wxMSW, wxGTK, QT and wxUniversal and always returns True in the other ports.
n (int) – The zero-based button position.
bool
SetItemHelpText(self, item, helptext)¶Sets the helptext for an item.
Empty string erases any existing helptext.
item (int) – The zero-based item index.
helptext (string) – The help text to set for the item.
See also
SetItemLabel(self, n, text)¶SetItemLabel(self, n, text)
Set the text of the n’th item in the radio box.
SetItemToolTip(self, item, text)¶Sets the tooltip text for the specified item in the radio group.
This function is currently only implemented in wxMSW and wxGTK2 and does nothing in the other ports.
item (int) – Index of the item the tooltip will be shown for.
text (string) – Tooltip text for the item, the tooltip is removed if empty.
See also
SetSelection(self, n)¶Sets the selection to the given item.
Notice that a radio box always has selection, so n must be valid here and passing NOT_FOUND is not allowed.
n (int) –
SetString(self, n, string)¶Sets the label for the given item.
n (int) – The zero-based item index.
string (string) – The label to set.
ShowItem(self, item, show=True)¶Shows or hides individual buttons.
item (int) – The zero-based position of the button to show or hide.
show (bool) – True to show, False to hide.
bool
True if the item has been shown or hidden or False if nothing was done because it already was in the requested state.
See also
ColumnCount¶See GetColumnCount
RowCount¶See GetRowCount
Selection¶See GetSelection and SetSelection