gtk.RadioButton
Prev | The gtk Class Reference | Next

## gtk.RadioButton

gtk.RadioButton — a choice of one of multiple check buttons.

## Synopsis

    class gtk.RadioButton(gtk.CheckButton):
        gtk.RadioButton(group=None, label=None, use_underline=True)
        def get_group()
        def set_group(group)

## Ancestry

    +-- gobject.GObject
      +-- gtk.Object
        +-- gtk.Widget
          +-- gtk.Container
            +-- gtk.Bin
              +-- gtk.Button
                +-- gtk.ToggleButton
                  +-- gtk.CheckButton
                    +-- gtk.RadioButton

## Implemented Interfaces

`gtk.RadioButton` implements `gtk.Buildable`

## gtk.RadioButton Properties

gtk.Object Properties

gtk.Widget Properties

gtk.Container Properties

gtk.Button Properties

gtk.ToggleButton Properties

"group" | Write | The group that the radiobutton is in.

## gtk.RadioButton Style Properties

gtk.Widget Style Properties

gtk.Button Style Properties

gtk.CheckButton Style Properties

## gtk.RadioButton Signal Prototypes

gobject.GObject Signal Prototypes

gtk.Object Signal Prototypes

gtk.Widget Signal Prototypes

gtk.Container Signal Prototypes

gtk.Button Signal Prototypes

gtk.ToggleButton Signal Prototypes

"group-changed" | `def callback(`radiobutton`, `user_param1`, `...`)`

## Description

A single `gtk.RadioButton` performs the same basic function as a `gtk.CheckButton`, as it's position in the object hierarchy reflects. It is only when multiple radio buttons are grouped together that they become a different user interface component in their own right. Every radio button is a member of some group of radio buttons. When one is selected, all other radio buttons in the same group are deselected. A `gtk.RadioButton` is used to give the user a choice of one of many options.

Radio button widgets are created with gtk.RadioButton() passing `None` as the `group` (first) argument if this is the first radio button in a group. In subsequent calls, pass a reference to a `gtk.RadioButton` as the first argument to specify the group. The second (optional) argument to gtk.RadioButton() is a label that is used to specify the text of the button. The label text is parsed for mnemonic characters (preceded by an underscore) to specify an accelerator for the radiobutton. See `gtk.AccelGroup` and `gtk.AccelLabel` for more information on mnemonic accelerators.

To retrieve the group a `gtk.RadioButton` is assigned to, use the `get_group`() method. To remove a `gtk.RadioButton` from one group and make it part of a new one, use the `set_group`() method.

## Constructor

        gtk.RadioButton(group=None, label=None, use_underline=True)

`group` : | an existing `gtk.RadioButton` or `None`
`label` : | a string to use as the button text or `None`
`use_underline` : | if `True`, an underscore in the label text indicates the next character should be underlined and used for the mnemonic accelerator key if it is the first character so marked. Available in PyGTK 2.4 and above.
Returns : | a new `gtk.RadioButton` widget

Creates a new `gtk.RadioButton` widget with the label text specified by `label`, adding it to the same group as `group`. `label` is parsed for underscore characters that indicate mnemonic accelerators. If `label` is `None`, no label is created. If `group` is `None`, the new radiobutton becomes the first member of a new radiobutton group.

In PyGTK 2.4 and above the `use_underline` parameter is available and defaults to `True`. If `use_underline` is set to `False` the label text will not be parsed for mnemonic characters.

## Methods

### gtk.RadioButton.get_group

        def get_group()

Returns : | the list of radiobuttons in the same group that contains the radiobutton or `None`

The `get_group`() method returns the list of radiobuttons that are in the same group as the radiobutton or `None` if the radiobutton is not in a group.

### gtk.RadioButton.set_group

        def set_group(group)

`group` : | a `gtk.RadioButton` whose group the radiobutton will be added to or `None`

The `set_group`() method adds the radiobutton to the group of the radiobutton specified by `group`.

In PyGTK 2.6.2 and above, if `group` is `None` the radiobutton is removed from its current group.

## Signals

### The "group-changed" gtk.RadioButton Signal

        def callback(radiobutton, user_param1, ...)

`radiobutton` : | the radiobutton that received the signal
`user_param1` : | the first user parameter (if any) specified with the `connect`() method
`...` : | additional user parameters (if any)

### Note

This signal is available in GTK+ 2.4 and above.

The "group-changed" signal is emitted when a `gtk.RadioButton` is added to or removed from the group.

Prev | Up | Next
gtk.RadioAction | Home | gtk.RadioMenuItem