Gtk.ToolButton¶
| Subclasses: | Gtk.MenuToolButton,Gtk.ToggleToolButton | 
|---|
Methods¶
| class | new(icon_widget, label) | 
| class | new_from_stock(stock_id) | 
| get_icon_name() | |
| get_icon_widget() | |
| get_label() | |
| get_label_widget() | |
| get_stock_id() | |
| get_use_underline() | |
| set_icon_name(icon_name) | |
| set_icon_widget(icon_widget) | |
| set_label(label) | |
| set_label_widget(label_widget) | |
| set_stock_id(stock_id) | |
| set_use_underline(use_underline) | 
Virtual Methods¶
| Inherited: | Gtk.ToolItem (2), Gtk.Container (10), Gtk.Widget (82), GObject.Object (7), Gtk.Buildable (10), Gtk.Activatable (2), Gtk.Actionable (4) | 
|---|
| do_clicked() | 
Properties¶
| Inherited: | Gtk.ToolItem (3), Gtk.Container (3), Gtk.Widget (39), Gtk.Activatable (2), Gtk.Actionable (2) | 
|---|
| Name | Type | Flags | Short Description | 
|---|---|---|---|
| icon-name | str | r/w | The name of the themed icon displayed on the item | 
| icon-widget | Gtk.Widget | r/w | Icon widget to display in the item | 
| label | str | r/w | Text to show in the item. | 
| label-widget | Gtk.Widget | r/w | Widget to use as the item label | 
| stock-id | str | d/r/w | The stock icon displayed on the item deprecated | 
| use-underline | bool | 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: | Gtk.Widget (17) | 
|---|
| Name | Type | Default | Flags | Short Description | 
|---|---|---|---|---|
| icon-spacing | int | 3 | 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 | 
|---|---|
| clicked | 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 | Gtk.ToolItem | r | 
Class Details¶
- 
class Gtk.ToolButton(*args, **kwargs)¶
- Bases: - Gtk.ToolItem,- Gtk.Actionable- Abstract: - No - Structure: - Gtk.ToolButtonClass- Gtk.ToolButtonsare- Gtk.ToolItemscontaining buttons.- Use - Gtk.ToolButton.new() to create a new- Gtk.ToolButton.- The label of a - Gtk.ToolButtonis determined by the properties- Gtk.ToolButton- :label-widget,- Gtk.ToolButton- :label, and- Gtk.ToolButton- :stock-id. If- Gtk.ToolButton- :label-widgetis non-- None, then that widget is used as the label. Otherwise, if- Gtk.ToolButton- :labelis non-- None, that string is used as the label. Otherwise, if- Gtk.ToolButton- :stock-idis non-- None, the label is determined by the stock item. Otherwise, the button does not have a label.- The icon of a - Gtk.ToolButtonis determined by the properties- Gtk.ToolButton- :icon-widgetand- Gtk.ToolButton- :stock-id. If- Gtk.ToolButton- :icon-widgetis non-- None, then that widget is used as the icon. Otherwise, if- Gtk.ToolButton- :stock-idis non-- None, the icon is determined by the stock item. Otherwise, the button does not have a icon.- CSS nodes
 - Gtk.ToolButtonhas 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.ToolButtonusing 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: - Gtk.ToolItem- Creates a new - Gtk.ToolButtoncontaining the image and text from a stock item. Some stock ids have preprocessor macros like- Gtk.STOCK_OKand- Gtk.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 with- Gtk.Image.new_from_icon_name() instead.
 - 
get_icon_name()[source]¶
- Returns: - the icon name or - Noneif the tool button has no themed icon- Return type: - stror- None- 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.Widgetor- None- 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, or - None- Return type: - stror- None- Returns the label used by the tool button, or - Noneif 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.Widgetor- None- 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: - str- 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: - Trueif underscores in the label property are used as mnemonics on menu items on the overflow menu.- Return type: - bool- 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]¶
- Parameters: - icon_name ( - stror- None) – the name of the themed icon- Sets the icon for the tool button from a named themed icon. See the docs for - Gtk.IconThemefor more details. The- Gtk.ToolButton- :icon-nameproperty only has an effect if not overridden by non-- None- Gtk.ToolButton- :label-widget,- Gtk.ToolButton- :icon-widgetand- Gtk.ToolButton- :stock-idproperties.- New in version 2.8. 
 - 
set_icon_widget(icon_widget)[source]¶
- Parameters: - icon_widget ( - Gtk.Widgetor- None) – the widget used as icon, or- None- Sets icon as the widget used as icon on self. If icon_widget is - Nonethe icon is determined by the- Gtk.ToolButton- :stock-idproperty. If the- Gtk.ToolButton- :stock-idproperty is also- None, self will not have an icon.- New in version 2.4. 
 - 
set_label(label)[source]¶
- Parameters: - label ( - stror- None) – a string that will be used as label, or- None.- Sets label as the label used for the tool button. The - Gtk.ToolButton- :labelproperty only has an effect if not overridden by a non-- None- Gtk.ToolButton- :label-widgetproperty. If both the- Gtk.ToolButton- :label-widgetand- Gtk.ToolButton- :labelproperties are- None, the label is determined by the- Gtk.ToolButton- :stock-idproperty. If the- Gtk.ToolButton- :stock-idproperty is also- None, self will not have a label.- New in version 2.4. 
 - 
set_label_widget(label_widget)[source]¶
- Parameters: - label_widget ( - Gtk.Widgetor- None) – the widget used as label, or- None- Sets label_widget as the widget that will be used as the label for self. If label_widget is - Nonethe- Gtk.ToolButton- :labelproperty is used as label. If- Gtk.ToolButton- :labelis also- None, the label in the stock item determined by the- Gtk.ToolButton- :stock-idproperty is used as label. If- Gtk.ToolButton- :stock-idis also- None, self does not have a label.- New in version 2.4. 
 - 
set_stock_id(stock_id)[source]¶
- Parameters: - stock_id ( - stror- None) – a name of a stock item, or- None- 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-widgetand- Gtk.ToolButton- :icon-widgetproperties.- 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 Details¶
- 
Gtk.ToolButton.signals.clicked(tool_button)¶
- Signal Name: - clicked- Flags: - RUN_FIRST,- ACTION- 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¶
- Name: - icon-name- Type: - str- Default Value: - None- Flags: - READABLE,- WRITABLE- 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-widgetor- Gtk.ToolButton- :stock-idproperties.- New in version 2.8. 
- 
Gtk.ToolButton.props.icon_widget¶
- Name: - icon-widget- Type: - Gtk.Widget- Default Value: - None- Flags: - READABLE,- WRITABLE- Icon widget to display in the item 
- 
Gtk.ToolButton.props.label¶
- Name: - label- Type: - str- Default Value: - None- Flags: - READABLE,- WRITABLE- Text to show in the item. 
- 
Gtk.ToolButton.props.label_widget¶
- Name: - label-widget- Type: - Gtk.Widget- Default Value: - None- Flags: - READABLE,- WRITABLE- Widget to use as the item label 
- 
Gtk.ToolButton.props.stock_id¶
- Name: - stock-id- Type: - str- Default Value: - None- Flags: - DEPRECATED,- READABLE,- WRITABLE- The stock icon displayed on the item - Deprecated since version 3.10: Use - Gtk.ToolButton- :icon-nameinstead.