*********** wx.RadioBox *********** Inheritance diagram for `wx.RadioBox`: | .. inheritance-diagram:: wx.RadioBox | Description =========== 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. .. seealso:: `wx.RadioButton `_, `wx.CheckBox `_ Derived From ^^^^^^^^^^^^^ * `wx.ControlWithItems `_ * `wx.Control `_ * `wx.Window `_ * `wx.EvtHandler `_ * `wx.Object `_ Window Styles ^^^^^^^^^^^^^ ================================================== ================================================== Window Style Description ================================================== ================================================== ``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. ``wx.RA_USE_CHECKBOX`` Use of the checkbox controls instead of radio buttons (currently supported only on PalmOS) ================================================== ================================================== Event Handling ^^^^^^^^^^^^^^ ================================================== ================================================== Event Name Description ================================================== ================================================== wx.EVT_RADIOBOX(id, func) Process a ``wx.wxEVT_COMMAND_RADIOBOX_SELECTED`` event, when a radiobutton is clicked. ================================================== ================================================== | Control Appearance ^^^^^^^^^^^^^^^^^^ | .. figure:: ../images/wxWidgets/wxmsw/radiobox.png :alt: wxMSW :figclass: floatleft **wxMSW** .. figure:: ../images/wxWidgets/wxmac/radiobox.png :alt: wxMAC :figclass: floatright **wxMAC** .. figure:: ../images/wxWidgets/wxgtk/radiobox.png :alt: wxGTK :figclass: floatcenter **wxGTK** | Methods Summary ^^^^^^^^^^^^^^^ * `__init__ <#__init__>`_ * `Enable <#Enable>`_ * `EnableItem <#EnableItem>`_ * `FindString <#FindString>`_ * `GetColumnCount <#GetColumnCount>`_ * `GetItemHelpText <#GetItemHelpText>`_ * `GetItemLabel <#GetItemLabel>`_ * `GetItemToolTip <#GetItemToolTip>`_ * `GetLabel <#GetLabel>`_ * `GetNextItem <#GetNextItem>`_ * `GetRowCount <#GetRowCount>`_ * `GetSelection <#GetSelection>`_ * `GetStringSelection <#GetStringSelection>`_ * `GetString <#GetString>`_ * `IsItemEnabled <#IsItemEnabled>`_ * `IsItemShown <#IsItemShown>`_ * `SetItemHelpText <#SetItemHelpText>`_ * `SetItemLabel <#SetItemLabel>`_ * `SetItemToolTip <#SetItemToolTip>`_ * `SetLabel <#SetLabel>`_ * `SetSelection <#SetSelection>`_ * `SetStringSelection <#SetStringSelection>`_ * `Show <#Show>`_ * `ShowItem <#ShowItem>`_ Properties Summary ^^^^^^^^^^^^^^^^^^ * `ColumnCount <#ColumnCount>`_ * `RowCount <#RowCount>`_ Class API ========= Methods ^^^^^^^ .. method:: __init__(parent, id=-1, label="", pos=wx.DefaultPosition, size=wx.DefaultSize, choices=[], majorDimension=0, style=wx.RA_SPECIFY_COLS, validator=wx.DefaultValidator, name=wx.RadioBoxNameStr) Constructor. **Parameters:** * `parent` (`wx.Window `_) * `id` (int) * `label` (string) * `pos` (`wx.Point `_) * `size` (`wx.Size `_) * `choices` (list of strings) * `majorDimension` (int) * `style` (long) * `validator` (`wx.Validator `_) * `name` (string) | **Returns:** `wx.RadioBox `_ -------- .. method:: Enable(enable=True) Enables or disables the entire radiobox. **Parameters:** * `enable` (bool): ``True`` to enable, ``False`` to disable .. seealso:: `wx.Window.Enable `_ -------- .. method:: EnableItem(n, enable=True) Enables or disables an individual button in the radiobox. **Parameters:** * `n` (int): The zero-based button to enable or disable. * `enable` (bool): ``True`` to enable, ``False`` to disable. -------- .. method:: FindString(string) Finds a button matching the given string, returning the position if found, or -1 if not found. **Parameters:** * `string` (string): The string to find. -------- .. method:: GetColumnCount() Returns the number of columns in the radiobox. | **Returns:** `int` -------- .. method:: GetItemHelpText(item) Returns the helptext associated with the specified `item` if any or ``""``. **Parameters:** * `item` (int): The zero-based item index. | **Returns:** `string` .. seealso:: `SetItemHelpText <#SetItemHelpText>`_ -------- .. method:: GetItemLabel(item) Enables or disables an individual button in the radiobox. **Parameters:** * `item` (int): Returns the label for the given button | **Returns:** `string` -------- .. method:: GetItemToolTip(item) Returns the tooltip associated with the specified item if any or ``None``. **Parameters:** * `item` (int): The zero-based item index. | **Returns:** `wx.ToolTip `_ .. seealso:: `SetItemToolTip <#SetItemToolTip>`_, `wx.Window.GetToolTip `_ -------- .. method:: GetLabel() Returns the radiobox label. | **Returns:** `string` -------- .. method:: GetNextItem(item, dir, style) | **Parameters:** * `item` (int) * `dir` (int) * `style` (long) | **Returns:** `int` -------- .. method:: GetRowCount() Returns the number of rows in the radiobox. | **Returns:** `unsigned int` -------- .. method:: GetSelection() Returns the zero-based position of the selected button. | **Returns:** `int` -------------------------------------------------------------------------------- .. method:: GetStringSelection() Returns the selected string. | **Returns:** `string` -------------------------------------------------------------------------------- .. method:: GetString(n) Returns the label for the button at the given position. **Parameters:** * `n` (int): The zero-based button position. | **Returns:** `string` -------- .. method:: IsItemEnabled(n) Returns ``True`` if the item is enabled or ``False`` if it was disabled using `EnableItem <#EnableItem>`_. **Parameters:** * `n` (int): The zero-based button position. | **Returns:** `bool` .. note:: **Platform note:** Currently only implemented in wxMSW, wxGTK and wxUniversal and always returns ``True`` in the other ports. -------- .. method:: IsItemShown(n) Returns ``True`` if the item is currently shown or ``False`` if it was hidden using `ShowItem <#ShowItem>`_. **Parameters:** * `n` (int): The zero-based button position. | **Returns:** `bool` .. note:: Note that this function returns ``True`` for an item which hadn't been hidden even if the entire radiobox is not currently shown. .. note:: **Platform note:** Currently only implemented in wxMSW, wxGTK and wxUniversal and always returns ``True`` in the other ports. -------- .. method:: SetItemHelpText(item, helptext) Sets the helptext for an item. Empty string erases any existing helptext. **Parameters:** * `item` (int): The zero-based item index. * `helptext` (string): The help text to set for the item. .. seealso:: `GetItemHelpText <#GetItemHelpText>`_ -------- .. method:: SetItemLabel(n, string): Sets the radiobox label. **Parameters:** * `n` (int): The zero-based button position. * `string` (string): The radiobutton label. -------- .. method:: SetItemToolTip(item, tooltip) Sets the tooltip text for the specified item in the radio group. **Parameters:** * `item` (int): The zero-based item index. * `tooltip` (string): The item tooltip. .. note:: **Platform note:** Currently only implemented in wxMSW and wxGTK2 and does nothing in the other ports. .. seealso:: `GetItemToolTip <#GetItemToolTip>`_, `wx.Window.SetToolTip `_ -------- .. method:: SetLabel(string): Sets the radiobox label. **Parameters:** * `string` (string): The radiobox label. -------- .. method:: SetSelection(n) Sets a button by passing the desired string position. This does not cause a ``wx.wxEVT_COMMAND_RADIOBOX_SELECTED`` event to get emitted. **Parameters:** * `n` (int): The zero-based button position. -------- .. method:: SetStringSelection(string) Sets a button by passing the desired string. This does not cause a ``wx.wxEVT_COMMAND_RADIOBOX_SELECTED`` event to get emitted. **Parameters:** * `string` (string): The label of the button to select. -------- .. method:: Show(show=True) Shows or hides the radiobox. Returns ``True`` if the box or item has been shown or hidden or ``False`` if nothing was done because it already was in the requested state. **Parameters:** * `show` (bool): ``True`` to show, ``False`` to hide. | **Returns:** `bool` .. seealso:: `wx.Window.Show `_ -------- .. method:: ShowItem(item, show=True) Shows or hides individual buttons. Returns ``True`` if the box or item has been shown or hidden or ``False`` if nothing was done because it already was in the requested state **Parameters:** * `item` (int): The zero-based position of the button to show or hide. * `show` (bool): ``True`` to show, ``False`` to hide. | **Returns:** `bool` -------- Properties ^^^^^^^^^^ .. attribute:: ColumnCount See `GetColumnCount <#GetColumnCount>`_ .. attribute:: RowCount See `GetRowCount <#GetRowCount>`_