Phoenix Logo

phoenix_title wx.RadioButton

A radio button item is a button which usually denotes one of several mutually exclusive options.

It has a text label next to a (usually) round button.

You can create a group of mutually-exclusive radio buttons by specifying RB_GROUP for the first in the group. The group ends when another radio button group is created, or there are no more radio buttons.

styles Window Styles

This class supports the following styles:

  • wx.RB_GROUP: Marks the beginning of a new group of radio buttons.
  • wx.RB_SINGLE: In some circumstances, radio buttons that are not consecutive siblings trigger a hang bug in Windows (only). If this happens, add this style to mark the button as not belonging to a group, and implement the mutually-exclusive group behaviour yourself.

events Events Emitted by this Class

Handlers bound for the following event types will receive a wx.CommandEvent parameter.

  • EVT_RADIOBUTTON: Process a wxEVT_RADIOBUTTON event, when the radiobutton is clicked.

class_hierarchy Class Hierarchy

Inheritance diagram for class RadioButton:

appearance Control Appearance


wxMSW

wxMSW

wxMAC

wxMAC

wxGTK

wxGTK


method_summary Methods Summary

__init__ Default constructor.
Create Creates the choice for two-step construction.
GetValue Returns True if the radio button is checked, False otherwise.
SetValue Sets the radio button to checked or unchecked status.

property_summary Properties Summary

Value See GetValue and SetValue

api Class API



class wx.RadioButton(Control)

Possible constructors:

RadioButton()

RadioButton(parent, id=ID_ANY, label="", pos=DefaultPosition,
            size=DefaultSize, style=0, validator=DefaultValidator,
            name=RadioButtonNameStr)

A radio button item is a button which usually denotes one of several mutually exclusive options.


Methods



__init__(self, *args, **kw)

overload Overloaded Implementations:



__init__ (self)

Default constructor.

See also

Create , wx.Validator



__init__ (self, parent, id=ID_ANY, label=””, pos=DefaultPosition, size=DefaultSize, style=0, validator=DefaultValidator, name=RadioButtonNameStr)

Constructor, creating and showing a radio button.

Parameters:
  • 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 radio button.
  • 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.
  • style (long) – Window style. See wx.RadioButton.
  • validator (wx.Validator) – Window validator.
  • name (string) – Window name.

See also

Create , wx.Validator





Create(self, parent, id=ID_ANY, label="", pos=DefaultPosition, size=DefaultSize, style=0, validator=DefaultValidator, name=RadioButtonNameStr)

Creates the choice for two-step construction.

See wx.RadioButton for further details.

Parameters:
Return type:

bool



GetValue(self)

Returns True if the radio button is checked, False otherwise.

Return type:bool


SetValue(self, value)

Sets the radio button to checked or unchecked status.

This does not cause a wxEVT_RADIOBUTTON event to get emitted.

If the radio button belongs to a radio group exactly one button in the group may be checked and so this method can be only called with value set to True. To uncheck a radio button in a group you must check another button in the same group.

Parameters:value (bool) – True to check, False to uncheck.

Properties



Value

See GetValue and SetValue