Gtk.RadioMenuItem

g Atk.ImplementorIface Atk.ImplementorIface Gtk.Widget Gtk.Widget Atk.ImplementorIface->Gtk.Widget GObject.GInterface GObject.GInterface GObject.GInterface->Atk.ImplementorIface Gtk.Actionable Gtk.Actionable GObject.GInterface->Gtk.Actionable Gtk.Activatable Gtk.Activatable GObject.GInterface->Gtk.Activatable Gtk.Buildable Gtk.Buildable GObject.GInterface->Gtk.Buildable GObject.InitiallyUnowned GObject.InitiallyUnowned GObject.InitiallyUnowned->Gtk.Widget GObject.Object GObject.Object GObject.Object->GObject.InitiallyUnowned Gtk.MenuItem Gtk.MenuItem Gtk.Actionable->Gtk.MenuItem Gtk.Activatable->Gtk.MenuItem Gtk.Bin Gtk.Bin Gtk.Bin->Gtk.MenuItem Gtk.Buildable->Gtk.Widget Gtk.CheckMenuItem Gtk.CheckMenuItem Gtk.RadioMenuItem Gtk.RadioMenuItem Gtk.CheckMenuItem->Gtk.RadioMenuItem Gtk.Container Gtk.Container Gtk.Container->Gtk.Bin Gtk.MenuItem->Gtk.CheckMenuItem Gtk.Widget->Gtk.Container

Subclasses:None

Properties

Inherited:Gtk.CheckMenuItem (3), Gtk.MenuItem (5), Gtk.Container (3), Gtk.Widget (39), Gtk.Actionable (2), Gtk.Activatable (2)
Name Type Flags Short Description
group Gtk.RadioMenuItem w The radio menu item whose group this widget belongs to.

Fields

Inherited:Gtk.CheckMenuItem (1), Gtk.MenuItem (6), Gtk.Container (4), Gtk.Widget (69), GObject.Object (1)
Name Type Access Description
check_menu_item Gtk.CheckMenuItem r  

Class Details

class Gtk.RadioMenuItem(*args, **kwargs)
Bases:Gtk.CheckMenuItem
Abstract:No
Structure:Gtk.RadioMenuItemClass

A radio menu item is a check menu item that belongs to a group. At each instant exactly one of the radio menu items from a group is selected.

The group list does not need to be freed, as each Gtk.RadioMenuItem will remove itself and its list item when it is destroyed.

The correct way to create a group of radio menu items is approximatively this:

How to create a group of radio menu items.
GSList *group = NULL;
GtkWidget *item;
gint i;

for (i = 0; i < 5; i++)
{
  item = gtk_radio_menu_item_new_with_label (group, "This is an example");
  group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (item));
  if (i == 1)
    gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (item), TRUE);
}
CSS nodes
menuitem
├── radio.left
╰── <child>

Gtk.RadioMenuItem has a main CSS node with name menuitem, and a subnode with name radio, which gets the .left or .right style class.

classmethod new(group)[source]
Parameters:group ([Gtk.RadioMenuItem] or None) – the group to which the radio menu item is to be attached, or None
Returns:a new Gtk.RadioMenuItem
Return type:Gtk.Widget

Creates a new Gtk.RadioMenuItem.

classmethod new_from_widget(group)[source]
Parameters:group (Gtk.RadioMenuItem or None) – An existing Gtk.RadioMenuItem
Returns:The new Gtk.RadioMenuItem
Return type:Gtk.Widget

Creates a new Gtk.RadioMenuItem adding it to the same group as group.

New in version 2.4.

classmethod new_with_label(group, label)[source]
Parameters:
Returns:

A new Gtk.RadioMenuItem

Return type:

Gtk.Widget

Creates a new Gtk.RadioMenuItem whose child is a simple Gtk.Label.

classmethod new_with_label_from_widget(group, label)[source]
Parameters:
Returns:

The new Gtk.RadioMenuItem

Return type:

Gtk.Widget

Creates a new Gtk.RadioMenuItem whose child is a simple Gtk.Label. The new Gtk.RadioMenuItem is added to the same group as group.

New in version 2.4.

classmethod new_with_mnemonic(group, label)[source]
Parameters:
  • group ([Gtk.RadioMenuItem] or None) – group the radio menu item is inside, or None
  • label (str) – the text of the button, with an underscore in front of the mnemonic character
Returns:

a new Gtk.RadioMenuItem

Return type:

Gtk.Widget

Creates a new Gtk.RadioMenuItem containing a label. The label will be created using Gtk.Label.new_with_mnemonic(), so underscores in label indicate the mnemonic for the menu item.

classmethod new_with_mnemonic_from_widget(group, label)[source]
Parameters:
Returns:

The new Gtk.RadioMenuItem

Return type:

Gtk.Widget

Creates a new Gtk.RadioMenuItem containing a label. The label will be created using Gtk.Label.new_with_mnemonic(), so underscores in label indicate the mnemonic for the menu item.

The new Gtk.RadioMenuItem is added to the same group as group.

New in version 2.4.

get_group()[source]
Returns:the group of self
Return type:[Gtk.RadioMenuItem]

Returns the group to which the radio menu item belongs, as a GLib.List of Gtk.RadioMenuItem. The list belongs to GTK+ and should not be freed.

join_group(group_source)[source]
Parameters:group_source (Gtk.RadioMenuItem or None) – a Gtk.RadioMenuItem whose group we are joining, or None to remove the self from its current group

Joins a Gtk.RadioMenuItem object to the group of another Gtk.RadioMenuItem object.

This function should be used by language bindings to avoid the memory manangement of the opaque GLib.SList of Gtk.RadioMenuItem.get_group() and Gtk.RadioMenuItem.set_group().

A common way to set up a group of Gtk.RadioMenuItem instances is:

GtkRadioMenuItem *last_item = NULL;

while ( ...more items to add... )
  {
    GtkRadioMenuItem *radio_item;

    radio_item = gtk_radio_menu_item_new (...);

    gtk_radio_menu_item_join_group (radio_item, last_item);
    last_item = radio_item;
  }

New in version 3.18.

set_group(group)[source]
Parameters:group ([Gtk.RadioMenuItem] or None) – the new group, or None.

Sets the group of a radio menu item, or changes it.

do_group_changed() virtual

Signal Details

Gtk.RadioMenuItem.signals.group_changed(radio_menu_item)
Signal Name:group-changed
Flags:RUN_FIRST
Parameters:radio_menu_item (Gtk.RadioMenuItem) – The object which received the signal

Property Details

Gtk.RadioMenuItem.props.group
Name:group
Type:Gtk.RadioMenuItem
Default Value:None
Flags:WRITABLE

The radio menu item whose group this widget belongs to.

New in version 2.8.