Gtk.ToolItem¶
| Subclasses: | Gtk.SeparatorToolItem,Gtk.ToolButton | 
|---|
Methods¶
| Inherited: | Gtk.Bin (1), Gtk.Container (35), Gtk.Widget (278), GObject.Object (37), Gtk.Buildable (10), Gtk.Activatable (6) | 
|---|---|
| Structs: | Gtk.ContainerClass (5), Gtk.WidgetClass (12), GObject.ObjectClass (5) | 
| class | new() | 
| get_ellipsize_mode() | |
| get_expand() | |
| get_homogeneous() | |
| get_icon_size() | |
| get_is_important() | |
| get_orientation() | |
| get_proxy_menu_item(menu_item_id) | |
| get_relief_style() | |
| get_text_alignment() | |
| get_text_orientation() | |
| get_text_size_group() | |
| get_toolbar_style() | |
| get_use_drag_window() | |
| get_visible_horizontal() | |
| get_visible_vertical() | |
| rebuild_menu() | |
| retrieve_proxy_menu_item() | |
| set_expand(expand) | |
| set_homogeneous(homogeneous) | |
| set_is_important(is_important) | |
| set_proxy_menu_item(menu_item_id, menu_item) | |
| set_tooltip_markup(markup) | |
| set_tooltip_text(text) | |
| set_use_drag_window(use_drag_window) | |
| set_visible_horizontal(visible_horizontal) | |
| set_visible_vertical(visible_vertical) | |
| toolbar_reconfigured() | 
Virtual Methods¶
| Inherited: | Gtk.Container (10), Gtk.Widget (82), GObject.Object (7), Gtk.Buildable (10), Gtk.Activatable (2) | 
|---|
| do_create_menu_proxy() | |
| do_toolbar_reconfigured() | 
Properties¶
| Inherited: | Gtk.Container (3), Gtk.Widget (39), Gtk.Activatable (2) | 
|---|
| Name | Type | Flags | Short Description | 
|---|---|---|---|
| is-important | bool | r/w/en | Whether the toolbar item is considered important. When True, toolbar buttons show text inGtk.ToolbarStyle.BOTH_HORIZmode | 
| visible-horizontal | bool | r/w/en | Whether the toolbar item is visible when the toolbar is in a horizontal orientation. | 
| visible-vertical | bool | r/w/en | Whether the toolbar item is visible when the toolbar is in a vertical orientation. | 
Style Properties¶
| Inherited: | Gtk.Widget (17) | 
|---|
Signals¶
| Inherited: | Gtk.Container (4), Gtk.Widget (69), GObject.Object (1) | 
|---|
| Name | Short Description | 
|---|---|
| create-menu-proxy | This signal is emitted when the toolbar needs information from tool_item about whether the item should appear in the toolbar overflow menu. | 
| toolbar-reconfigured | This signal is emitted when some property of the toolbar that the item is a child of changes. | 
Fields¶
| Inherited: | Gtk.Container (4), Gtk.Widget (69), GObject.Object (1) | 
|---|
| Name | Type | Access | Description | 
|---|---|---|---|
| parent | Gtk.Bin | r | 
Class Details¶
- 
class Gtk.ToolItem(**kwargs)¶
- Bases: - Gtk.Bin,- Gtk.Activatable- Abstract: - No - Structure: - Gtk.ToolItemClass- Gtk.ToolItemsare widgets that can appear on a toolbar. To create a toolbar item that contain something else than a button, use- Gtk.ToolItem.new(). Use- Gtk.Container.add() to add a child widget to the tool item.- For toolbar items that contain buttons, see the - Gtk.ToolButton,- Gtk.ToggleToolButtonand- Gtk.RadioToolButtonclasses.- See the - Gtk.Toolbarclass for a description of the toolbar widget, and- Gtk.ToolShellfor a description of the tool shell interface.- 
classmethod new()[source]¶
- Returns: - the new - Gtk.ToolItem- Return type: - Gtk.ToolItem- Creates a new - Gtk.ToolItem- New in version 2.4. 
 - 
get_ellipsize_mode()[source]¶
- Returns: - a - Pango.EllipsizeModeindicating how text in self should be ellipsized.- Return type: - Pango.EllipsizeMode- Returns the ellipsize mode used for self. Custom subclasses of - Gtk.ToolItemshould call this function to find out how text should be ellipsized.- New in version 2.20. 
 - 
get_expand()[source]¶
- Returns: - Trueif self is allocated extra space.- Return type: - bool- Returns whether self is allocated extra space. See - Gtk.ToolItem.set_expand().- New in version 2.4. 
 - 
get_homogeneous()[source]¶
- Returns: - Trueif the item is the same size as other homogeneous items.- Return type: - bool- Returns whether self is the same size as other homogeneous items. See - Gtk.ToolItem.set_homogeneous().- New in version 2.4. 
 - 
get_icon_size()[source]¶
- Returns: - a - Gtk.IconSizeindicating the icon size used for self- Return type: - int- Returns the icon size used for self. Custom subclasses of - Gtk.ToolItemshould call this function to find out what size icons they should use.- New in version 2.4. 
 - 
get_is_important()[source]¶
- Returns: - Trueif self is considered important.- Return type: - bool- Returns whether self is considered important. See - Gtk.ToolItem.set_is_important()- New in version 2.4. 
 - 
get_orientation()[source]¶
- Returns: - a - Gtk.Orientationindicating the orientation used for self- Return type: - Gtk.Orientation- Returns the orientation used for self. Custom subclasses of - Gtk.ToolItemshould call this function to find out what size icons they should use.- New in version 2.4. 
 - Parameters: - menu_item_id ( - str) – a string used to identify the menu item- Returns: - The - Gtk.MenuItempassed to- Gtk.ToolItem.set_proxy_menu_item(), if the menu_item_ids match.- Return type: - Gtk.Widgetor- None- If menu_item_id matches the string passed to - Gtk.ToolItem.set_proxy_menu_item() return the corresponding- Gtk.MenuItem.- Custom subclasses of - Gtk.ToolItemshould use this function to update their menu item when the- Gtk.ToolItemchanges. That the menu_item_ids must match ensures that a- Gtk.ToolItemwill not inadvertently change a menu item that they did not create.- New in version 2.4. 
 - 
get_relief_style()[source]¶
- Returns: - a - Gtk.ReliefStyleindicating the relief style used for self.- Return type: - Gtk.ReliefStyle- Returns the relief style of self. See - Gtk.Button.set_relief(). Custom subclasses of- Gtk.ToolItemshould call this function in the handler of the #GtkToolItem::toolbar_reconfigured signal to find out the relief style of buttons.- New in version 2.4. 
 - 
get_text_alignment()[source]¶
- Returns: - a - floatindicating the horizontal text alignment used for self- Return type: - float- Returns the text alignment used for self. Custom subclasses of - Gtk.ToolItemshould call this function to find out how text should be aligned.- New in version 2.20. 
 - 
get_text_orientation()[source]¶
- Returns: - a - Gtk.Orientationindicating the text orientation used for self- Return type: - Gtk.Orientation- Returns the text orientation used for self. Custom subclasses of - Gtk.ToolItemshould call this function to find out how text should be orientated.- New in version 2.20. 
 - 
get_text_size_group()[source]¶
- Returns: - a - Gtk.SizeGroup- Return type: - Gtk.SizeGroup- Returns the size group used for labels in self. Custom subclasses of - Gtk.ToolItemshould call this function and use the size group for labels.- New in version 2.20. 
 - 
get_toolbar_style()[source]¶
- Returns: - A - Gtk.ToolbarStyleindicating the toolbar style used for self.- Return type: - Gtk.ToolbarStyle- Returns the toolbar style used for self. Custom subclasses of - Gtk.ToolItemshould call this function in the handler of the GtkToolItem::toolbar_reconfigured signal to find out in what style the toolbar is displayed and change themselves accordingly- Possibilities are: - Gtk.ToolbarStyle.BOTH, meaning the tool item should show both an icon and a label, stacked vertically
- Gtk.ToolbarStyle.ICONS, meaning the toolbar shows only icons
- Gtk.ToolbarStyle.TEXT, meaning the tool item should only show text
- Gtk.ToolbarStyle.BOTH_HORIZ, meaning the tool item should show both an icon and a label, arranged horizontally
 - New in version 2.4. 
 - 
get_use_drag_window()[source]¶
- Returns: - Trueif self uses a drag window.- Return type: - bool- Returns whether self has a drag window. See - Gtk.ToolItem.set_use_drag_window().- New in version 2.4. 
 - 
get_visible_horizontal()[source]¶
- Returns: - Trueif self is visible on toolbars that are docked horizontally.- Return type: - bool- Returns whether the self is visible on toolbars that are docked horizontally. - New in version 2.4. 
 - 
get_visible_vertical()[source]¶
- Returns: - Whether self is visible when the toolbar is docked vertically - Return type: - bool- Returns whether self is visible when the toolbar is docked vertically. See - Gtk.ToolItem.set_visible_vertical().- New in version 2.4. 
 - Calling this function signals to the toolbar that the overflow menu item for self has changed. If the overflow menu is visible when this function it called, the menu will be rebuilt. - The function must be called when the tool item changes what it will do in response to the - Gtk.ToolItem- ::create-menu-proxysignal.- New in version 2.6. 
 - Returns: - The - Gtk.MenuItemthat is going to appear in the overflow menu for self.- Return type: - Gtk.Widget- Returns the - Gtk.MenuItemthat was last set by- Gtk.ToolItem.set_proxy_menu_item(), ie. the- Gtk.MenuItemthat is going to appear in the overflow menu.- New in version 2.4. 
 - 
set_expand(expand)[source]¶
- Parameters: - expand ( - bool) – Whether self is allocated extra space- Sets whether self is allocated extra space when there is more room on the toolbar then needed for the items. The effect is that the item gets bigger when the toolbar gets bigger and smaller when the toolbar gets smaller. - New in version 2.4. 
 - 
set_homogeneous(homogeneous)[source]¶
- Parameters: - homogeneous ( - bool) – whether self is the same size as other homogeneous items- Sets whether self is to be allocated the same size as other homogeneous items. The effect is that all homogeneous items will have the same width as the widest of the items. - New in version 2.4. 
 - 
set_is_important(is_important)[source]¶
- Parameters: - is_important ( - bool) – whether the tool item should be considered important- Sets whether self should be considered important. The - Gtk.ToolButtonclass uses this property to determine whether to show or hide its label when the toolbar style is- Gtk.ToolbarStyle.BOTH_HORIZ. The result is that only tool buttons with the “is_important” property set have labels, an effect known as “priority text”- New in version 2.4. 
 - Parameters: - menu_item_id (str) – a string used to identify menu_item
- menu_item (Gtk.WidgetorNone) – aGtk.MenuItemto use in the overflow menu, orNone
 - Sets the - Gtk.MenuItemused in the toolbar overflow menu. The menu_item_id is used to identify the caller of this function and should also be used with- Gtk.ToolItem.get_proxy_menu_item().- See also - Gtk.ToolItem- ::create-menu-proxy.- New in version 2.4. 
- menu_item_id (
 - 
set_tooltip_markup(markup)[source]¶
- Parameters: - markup ( - str) – markup text to be used as tooltip for self- Sets the markup text to be displayed as tooltip on the item. See - Gtk.Widget.set_tooltip_markup().- New in version 2.12. 
 - 
set_tooltip_text(text)[source]¶
- Parameters: - text ( - str) – text to be used as tooltip for self- Sets the text to be displayed as tooltip on the item. See - Gtk.Widget.set_tooltip_text().- New in version 2.12. 
 - 
set_use_drag_window(use_drag_window)[source]¶
- Parameters: - use_drag_window ( - bool) – Whether self has a drag window.- Sets whether self has a drag window. When - Truethe toolitem can be used as a drag source through- Gtk.Widget.drag_source_set(). When self has a drag window it will intercept all events, even those that would otherwise be sent to a child of self.- New in version 2.4. 
 - 
set_visible_horizontal(visible_horizontal)[source]¶
- Parameters: - visible_horizontal ( - bool) – Whether self is visible when in horizontal mode- Sets whether self is visible when the toolbar is docked horizontally. - New in version 2.4. 
 - 
set_visible_vertical(visible_vertical)[source]¶
- Parameters: - visible_vertical ( - bool) – whether self is visible when the toolbar is in vertical mode- Sets whether self is visible when the toolbar is docked vertically. Some tool items, such as text entries, are too wide to be useful on a vertically docked toolbar. If visible_vertical is - Falseself will not appear on toolbars that are docked vertically.- New in version 2.4. 
 - 
toolbar_reconfigured()[source]¶
- Emits the signal #GtkToolItem::toolbar_reconfigured on self. - Gtk.Toolbarand other- Gtk.ToolShellimplementations use this function to notify children, when some aspect of their configuration changes.- New in version 2.14. 
 - Return type: - bool
 - 
do_toolbar_reconfigured() virtual¶
- Emits the signal #GtkToolItem::toolbar_reconfigured on tool_item. - Gtk.Toolbarand other- Gtk.ToolShellimplementations use this function to notify children, when some aspect of their configuration changes.- New in version 2.14. 
 
- 
classmethod 
Signal Details¶
- Signal Name: - create-menu-proxy- Flags: - RUN_LAST- Parameters: - tool_item ( - Gtk.ToolItem) – The object which received the signal- Returns: - Trueif the signal was handled,- Falseif not- Return type: - bool- This signal is emitted when the toolbar needs information from tool_item about whether the item should appear in the toolbar overflow menu. In response the tool item should either - call Gtk.ToolItem.set_proxy_menu_item() with aNonepointer and returnTrueto indicate that the item should not appear in the overflow menu
- call Gtk.ToolItem.set_proxy_menu_item() with a new menu item and returnTrue, or
- return Falseto indicate that the signal was not handled by the item. This means that the item will not appear in the overflow menu unless a later handler installs a menu item.
 - The toolbar may cache the result of this signal. When the tool item changes how it will respond to this signal it must call - Gtk.ToolItem.rebuild_menu() to invalidate the cache and ensure that the toolbar rebuilds its overflow menu.
- call 
- 
Gtk.ToolItem.signals.toolbar_reconfigured(tool_item)¶
- Signal Name: - toolbar-reconfigured- Flags: - RUN_LAST- Parameters: - tool_item ( - Gtk.ToolItem) – The object which received the signal- This signal is emitted when some property of the toolbar that the item is a child of changes. For custom subclasses of - Gtk.ToolItem, the default handler of this signal use the functions- Gtk.ToolShell.get_orientation()
- Gtk.ToolShell.get_style()
- Gtk.ToolShell.get_icon_size()
- Gtk.ToolShell.get_relief_style() to find out what the toolbar should look like and change themselves accordingly.
 
Property Details¶
- 
Gtk.ToolItem.props.is_important¶
- Name: - is-important- Type: - bool- Default Value: - False- Flags: - READABLE,- WRITABLE,- EXPLICIT_NOTIFY- Whether the toolbar item is considered important. When - True, toolbar buttons show text in- Gtk.ToolbarStyle.BOTH_HORIZmode