Table Of Contents

Previous topic

RadioBox

Next topic

RasterOperationMode

This Page

phoenix_title 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:

  • RB_GROUP: Marks the beginning of a new group of radio buttons.
  • 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 CommandEvent parameter.

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

class_hierarchy Inheritance Diagram

Inheritance diagram for class RadioButton

Inheritance diagram of 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 RadioButton(Control)

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

Possible constructors:

RadioButton()

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

Methods



__init__(self, *args, **kw)

overload Overloaded Implementations:



__init__ (self)

Default constructor.

See also

Create , 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 (Window) – Parent window. Must not be None.
  • id (int) – Window identifier. The value ID_ANY indicates a default value.
  • label (string) – Label for the radio button.
  • pos (Point) – Window position. If DefaultPosition is specified then a default position is chosen.
  • size (Size) – Window size. If DefaultSize is specified then a default size is chosen.
  • style (long) – Window style. See RadioButton.
  • validator (Validator) – Window validator.
  • name (string) – Window name.

See also

Create , 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 RadioButton for further details.

Parameters:
  • parent (Window) –
  • id (int) –
  • label (string) –
  • pos (Point) –
  • size (Size) –
  • style (long) –
  • validator (Validator) –
  • name (string) –
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_COMMAND_RADIOBUTTON_SELECTED 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