Gtk.RadioToolButton
Gtk.RadioToolButton — A toolbar item that contains a radio button
Object Hierarchy:
GObject
╰── GInitiallyUnowned
╰── Gtk.Widget
╰── Gtk.Container
╰── Gtk.Bin
╰── Gtk.ToolItem
╰── Gtk.ToolButton
╰── Gtk.ToggleToolButton
╰── Gtk.RadioToolButton
See also:
Functions:
- new
(group:list=None) -> Gtk.ToolItem
- new_from_stock
(group:list=None, stock_id:str) -> Gtk.ToolItem
- new_from_widget
(group:Gtk.RadioToolButton=None) -> Gtk.ToolItem
- new_with_stock_from_widget
(group:Gtk.RadioToolButton=None, stock_id:str) -> Gtk.ToolItem
- get_group
(self) -> list
- set_group
(self, group:list=None)
Description:
A Gtk.RadioToolButton
is a GtkToolItem that contains a radio button, that is, a button that is part of a group of toggle buttons where only one button can be active at a time.
Use Gtk.RadioToolButton::new()
to create a new Gtk.RadioToolButton
. Use Gtk.RadioToolButton::new_from_widget()
to create a new Gtk.RadioToolButton
that is part of the same group as an existing Gtk.RadioToolButton
.
Function Details:
new()
new (group:list=None) -> Gtk.ToolItem
Creates a new Gtk.RadioToolButton
, adding it to group
.
Returns: The new Gtk.RadioToolButton
Since: 2.4
new_from_stock()
new_from_stock (group:list=None, stock_id:str) -> Gtk.ToolItem
Gtk.RadioToolButton:new_from_stock
has been deprecated since version 3.10 and should not be used in newly-written code.
Use Gtk.RadioToolButton:new()
instead.
Creates a new Gtk.RadioToolButton
, adding it to group
. The new Gtk.RadioToolButton
will contain an icon and label from thestock item indicated by stock_id
.
Returns: The new Gtk.RadioToolButton
Since: 2.4
new_from_widget()
new_from_widget (group:Gtk.RadioToolButton=None) -> Gtk.ToolItem
Creates a new Gtk.RadioToolButton
adding it to the same group as gruup
[constructor]
Returns: The new
Gtk.RadioToolButton
.Since: 2.4
new_with_stock_from_widget()
new_with_stock_from_widget (group:Gtk.RadioToolButton=None, stock_id:str) -> Gtk.ToolItem
Gtk.RadioToolButton:new_with_stock_from_widget
has been deprecated since version 3.10 and should not be used in newly-written code.
Gtk.RadioToolButton:new_from_widget
Creates a new Gtk.RadioToolButton
adding it to the same group as group
.The new Gtk.RadioToolButton
will contain an icon and label from thestock item indicated by stock_id
.
[constructor]
Returns: A new
Gtk.RadioToolButton
.Since: 2.4
get_group()
get_group (self) -> list
Returns the radio button group button
belongs to.
Returns: The group
button
belongs to.Since: 2.4
set_group()
set_group (self, group:list=None)
Adds button
to group
, removing it from the group it belonged to before.
- Since: 2.4
Example:
import gi
gi.require_version('Gtk', '3.0')
from gi.repository import Gtk
window = Gtk.Window()
window.set_default_size(200, -1)
window.connect("destroy", Gtk.main_quit)
toolbar = Gtk.Toolbar()
window.add(toolbar)
toolbutton1 = Gtk.RadioToolButton(group=None)
toolbutton1.set_label("Preferences")
toolbutton1.set_icon_name("gtk-preferences")
toolbutton1.set_is_important(True)
toolbar.insert(toolbutton1, 0)
toolbutton2 = Gtk.RadioToolButton(group=toolbutton1)
toolbutton2.set_icon_name("gtk-about")
toolbar.insert(toolbutton2, 1)
toolbutton3 = Gtk.RadioToolButton(group=toolbutton1)
toolbutton3.set_icon_name("gtk-help")
toolbar.insert(toolbutton3, 2)
window.show_all()
Gtk.main()