RadioButton (Python) Marta Maria Casetti mmcasetti@gmail.com 2012 Mutually exclusive buttons. RadioButton

Three RadioButtons. You can see in the terminal if they are turned off or on.

Code used to generate this example
Useful methods for a RadioButton widget

In line 16 the signal "toggled" is connected to the callback function toggled_cb() using widget.connect(signal, callback function). See for a more detailed explanation.

As seen in , instead of button1 = Gtk.RadioButton(label="Button 1") we could create the button and label it with

button1 = Gtk.RadioButton() button1.set_label("Button 1").

Yet another way to create a new RadioButton with a label is button1 = Gtk.RadioButton.new_with_label(None, "Button 1") (the first argument is the group of the radiobuttons, which we can get with get_group(), the second argument is the label).

API References

In this sample we used the following:

GtkWindow

GtkGrid

GtkRadioButton