Gtk.ToolButton¶
- Subclasses:
Methods¶
- Inherited:
Gtk.ToolItem (28), Gtk.Bin (1), Gtk.Container (35), Gtk.Widget (278), GObject.Object (37), Gtk.Buildable (10), Gtk.Activatable (6), Gtk.Actionable (5)
- Structs:
Gtk.ContainerClass (5), Gtk.WidgetClass (12), GObject.ObjectClass (5)
class |
|
class |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Virtual Methods¶
- Inherited:
Gtk.ToolItem (2), Gtk.Container (10), Gtk.Widget (82), GObject.Object (7), Gtk.Buildable (10), Gtk.Activatable (2), Gtk.Actionable (4)
|
Properties¶
- Inherited:
Gtk.ToolItem (3), Gtk.Container (3), Gtk.Widget (39), Gtk.Activatable (2), Gtk.Actionable (2)
Name |
Type |
Flags |
Short Description |
---|---|---|---|
r/w |
The name of the themed icon displayed on the item |
||
r/w |
Icon widget to display in the item |
||
r/w |
Text to show in the item. |
||
r/w |
Widget to use as the item label |
||
d/r/w |
The stock icon displayed on the item |
||
r/w/en |
If set, an underline in the label property indicates that the next character should be used for the mnemonic accelerator key in the overflow menu |
Style Properties¶
- Inherited:
Name |
Type |
Default |
Flags |
Short Description |
---|---|---|---|---|
|
|
r/w |
Spacing in pixels between the icon and label |
Signals¶
- Inherited:
Gtk.ToolItem (2), Gtk.Container (4), Gtk.Widget (69), GObject.Object (1)
Name |
Short Description |
---|---|
This signal is emitted when the tool button is clicked with the mouse or activated with the keyboard. |
Fields¶
- Inherited:
Gtk.ToolItem (2), Gtk.Container (4), Gtk.Widget (69), GObject.Object (1)
Name |
Type |
Access |
Description |
---|---|---|---|
parent |
r |
Class Details¶
- class Gtk.ToolButton(*args, **kwargs)¶
- Bases:
- Abstract:
No
- Structure:
Gtk.ToolButtons
areGtk.ToolItems
containing buttons.Use
Gtk.ToolButton.new
() to create a newGtk.ToolButton
.The label of a
Gtk.ToolButton
is determined by the propertiesGtk.ToolButton
:label-widget
,Gtk.ToolButton
:label
, andGtk.ToolButton
:stock-id
. IfGtk.ToolButton
:label-widget
is non-None
, then that widget is used as the label. Otherwise, ifGtk.ToolButton
:label
is non-None
, that string is used as the label. Otherwise, ifGtk.ToolButton
:stock-id
is non-None
, the label is determined by the stock item. Otherwise, the button does not have a label.The icon of a
Gtk.ToolButton
is determined by the propertiesGtk.ToolButton
:icon-widget
andGtk.ToolButton
:stock-id
. IfGtk.ToolButton
:icon-widget
is non-None
, then that widget is used as the icon. Otherwise, ifGtk.ToolButton
:stock-id
is non-None
, the icon is determined by the stock item. Otherwise, the button does not have a icon.- CSS nodes
Gtk.ToolButton
has a single CSS node with name toolbutton.- classmethod new(icon_widget, label)[source]¶
- Parameters:
- Returns:
A new
Gtk.ToolButton
- Return type:
Creates a new
Gtk.ToolButton
using icon_widget as contents and label as label.New in version 2.4.
- classmethod new_from_stock(stock_id)[source]¶
- Parameters:
stock_id (
str
) – the name of the stock item- Returns:
A new
Gtk.ToolButton
- Return type:
Creates a new
Gtk.ToolButton
containing the image and text from a stock item. Some stock ids have preprocessor macros likeGtk.STOCK_OK
andGtk.STOCK_APPLY
.It is an error if stock_id is not a name of a stock item.
New in version 2.4.
Deprecated since version 3.10: Use
Gtk.ToolButton.new
() together withGtk.Image.new_from_icon_name
() instead.
- get_icon_name()[source]¶
-
Returns the name of the themed icon for the tool button, see
Gtk.ToolButton.set_icon_name
().New in version 2.8.
- get_icon_widget()[source]¶
- Returns:
The widget used as icon on self, or
None
.- Return type:
Gtk.Widget
orNone
Return the widget used as icon widget on self. See
Gtk.ToolButton.set_icon_widget
().New in version 2.4.
- get_label()[source]¶
-
Returns the label used by the tool button, or
None
if the tool button doesn’t have a label. or uses a the label from a stock item. The returned string is owned by GTK+, and must not be modified or freed.New in version 2.4.
- get_label_widget()[source]¶
- Returns:
The widget used as label on self, or
None
.- Return type:
Gtk.Widget
orNone
Returns the widget used as label on self. See
Gtk.ToolButton.set_label_widget
().New in version 2.4.
- get_stock_id()[source]¶
- Returns:
the name of the stock item for self.
- Return type:
Returns the name of the stock item. See
Gtk.ToolButton.set_stock_id
(). The returned string is owned by GTK+ and must not be freed or modifed.New in version 2.4.
Deprecated since version 3.10: Use
Gtk.ToolButton.get_icon_name
() instead.
- get_use_underline()[source]¶
- Returns:
True
if underscores in the label property are used as mnemonics on menu items on the overflow menu.- Return type:
Returns whether underscores in the label property are used as mnemonics on menu items on the overflow menu. See
Gtk.ToolButton.set_use_underline
().New in version 2.4.
- set_icon_name(icon_name)[source]¶
-
Sets the icon for the tool button from a named themed icon. See the docs for
Gtk.IconTheme
for more details. TheGtk.ToolButton
:icon-name
property only has an effect if not overridden by non-None
Gtk.ToolButton
:label-widget
,Gtk.ToolButton
:icon-widget
andGtk.ToolButton
:stock-id
properties.New in version 2.8.
- set_icon_widget(icon_widget)[source]¶
- Parameters:
icon_widget (
Gtk.Widget
orNone
) – the widget used as icon, orNone
Sets icon as the widget used as icon on self. If icon_widget is
None
the icon is determined by theGtk.ToolButton
:stock-id
property. If theGtk.ToolButton
:stock-id
property is alsoNone
, self will not have an icon.New in version 2.4.
- set_label(label)[source]¶
-
Sets label as the label used for the tool button. The
Gtk.ToolButton
:label
property only has an effect if not overridden by a non-None
Gtk.ToolButton
:label-widget
property. If both theGtk.ToolButton
:label-widget
andGtk.ToolButton
:label
properties areNone
, the label is determined by theGtk.ToolButton
:stock-id
property. If theGtk.ToolButton
:stock-id
property is alsoNone
, self will not have a label.New in version 2.4.
- set_label_widget(label_widget)[source]¶
- Parameters:
label_widget (
Gtk.Widget
orNone
) – the widget used as label, orNone
Sets label_widget as the widget that will be used as the label for self. If label_widget is
None
theGtk.ToolButton
:label
property is used as label. IfGtk.ToolButton
:label
is alsoNone
, the label in the stock item determined by theGtk.ToolButton
:stock-id
property is used as label. IfGtk.ToolButton
:stock-id
is alsoNone
, self does not have a label.New in version 2.4.
- set_stock_id(stock_id)[source]¶
-
Sets the name of the stock item. See
Gtk.ToolButton.new_from_stock
(). The stock_id property only has an effect if not overridden by non-None
Gtk.ToolButton
:label-widget
andGtk.ToolButton
:icon-widget
properties.New in version 2.4.
Deprecated since version 3.10: Use
Gtk.ToolButton.set_icon_name
() instead.
- set_use_underline(use_underline)[source]¶
- Parameters:
use_underline (
bool
) – whether the button label has the form “_Open”
If set, an underline in the label property indicates that the next character should be used for the mnemonic accelerator key in the overflow menu. For example, if the label property is “_Open” and use_underline is
True
, the label on the tool button will be “Open” and the item on the overflow menu will have an underlined “O”.Labels shown on tool buttons never have mnemonics on them; this property only affects the menu item on the overflow menu.
New in version 2.4.
- do_clicked() virtual¶
Signal emitted when the tool button is clicked with the mouse or activated with the keyboard.
Signal Details¶
- Gtk.ToolButton.signals.clicked(tool_button)¶
- Signal Name:
clicked
- Flags:
- Parameters:
tool_button (
Gtk.ToolButton
) – The object which received the signal
This signal is emitted when the tool button is clicked with the mouse or activated with the keyboard.
Property Details¶
- Gtk.ToolButton.props.icon_name¶
-
The name of the themed icon displayed on the item. This property only has an effect if not overridden by
Gtk.ToolButton
:label-widget
,Gtk.ToolButton
:icon-widget
orGtk.ToolButton
:stock-id
properties.New in version 2.8.
- Gtk.ToolButton.props.icon_widget¶
- Name:
icon-widget
- Type:
- Default Value:
- Flags:
Icon widget to display in the item
- Gtk.ToolButton.props.label¶
-
Text to show in the item.
- Gtk.ToolButton.props.label_widget¶
- Name:
label-widget
- Type:
- Default Value:
- Flags:
Widget to use as the item label
- Gtk.ToolButton.props.stock_id¶
- Name:
stock-id
- Type:
- Default Value:
- Flags:
The stock icon displayed on the item
Deprecated since version 3.10: Use
Gtk.ToolButton
:icon-name
instead.