gtk.Toolbar
Prev | The gtk Class Reference | Next

## gtk.Toolbar

gtk.Toolbar — a bar holding buttons and other widgets.

## Synopsis

    class gtk.Toolbar(gtk.Container):
        gtk.Toolbar()
        def insert(item, pos)
        def get_item_index(item)
        def get_n_items()
        def get_nth_item(n)
        def get_drop_index(x, y)
        def set_drop_highlight_item(tool_item, index)
        def set_show_arrow(show_arrow)
        def get_show_arrow()
        def get_relief_style()
        def append_item(text, tooltip_text, tooltip_private_text, icon, callback, user_data=None)
        def prepend_item(text, tooltip_text, tooltip_private_text, icon, callback, user_data)
        def insert_item(text, tooltip_text, tooltip_private_text, icon, callback, user_data, position)
        def insert_stock(stock_id, tooltip_text, tooltip_private_text, callback, user_data, position)
        def append_space()
        def prepend_space()
        def insert_space(position)
        def remove_space(position)
        def append_element(type, widget, text, tooltip_text, tooltip_private_text, icon, callback, user_data)
        def prepend_element(type, widget, text, tooltip_text, tooltip_private_text, icon, callback, user_data)
        def insert_element(type, widget, text, tooltip_text, tooltip_private_text, icon, callback, user_data, position)
        def append_widget(widget, tooltip_text, tooltip_private_text)
        def prepend_widget(widget, tooltip_text, tooltip_private_text)
        def insert_widget(widget, tooltip_text, tooltip_private_text, position)
        def set_orientation(orientation)
        def set_style(style)
        def set_icon_size(icon_size)
        def set_tooltips(enable)
        def unset_style()
        def unset_icon_size()
        def get_orientation()
        def get_style()
        def get_icon_size()
        def get_tooltips()

## Ancestry

    +-- gobject.GObject
      +-- gtk.Object
        +-- gtk.Widget
          +-- gtk.Container
            +-- gtk.Toolbar

## gtk.Toolbar Properties

gtk.Object Properties

gtk.Widget Properties

gtk.Container Properties

"icon-size" | Read-Write | The size of the icons in a toolbar is normally determined by the "toolbar-icon-size" setting. When this property is set, it overrides the setting. This should only be used for special-purpose toolbars, normal application toolbars should respect the user preferences for the size of icons. This property is available in GTK+ 2.10 and above.
"icon-size-set" | Read-Write | if `True` the icon-size property has been set. This property is available in GTK+ 2.10 and above.
"orientation" | Read-Write | The orientation of the toolbar: `gtk.ORIENTATION_HORIZONTAL` or `gtk.ORIENTATION_VERTICAL`
"show-arrow" | Read-Write | If `True` an arrow should be shown if the toolbar doesn't fit. Available in GTK+ 2.4 and above.
"toolbar-style" | Read-Write | The toolbar style: `gtk.TOOLBAR_ICONS`, `gtk.TOOLBAR_TEXT`, `gtk.TOOLBAR_BOTH` or `gtk.TOOLBAR_BOTH_HORIZ`
"tooltips" | Read-Write | If the tooltips of the toolbar should be active or not. This property is available in GTK+ 2.8 and above.

## gtk.Toolbar Style Properties

gtk.Widget Style Properties

"button-relief" | Read | The type of bevel around toolbar buttons: `gtk.RELIEF_NORMAL`, `gtk.RELIEF_HALF` or `gtk.RELIEF_NONE`
"internal-padding" | Read | The amount of border space between the toolbar shadow and the buttons
"max-child-expand" | Read | Maximum amount of space an expandable item will be given
"shadow-type" | Read | The style of bevel around the toolbar: `gtk.SHADOW_NONE`, `gtk.SHADOW_IN`, `gtk.SHADOW_OUT`, `gtk.SHADOW_ETCHED_IN` or `gtk.SHADOW_ETCHED_OUT`
"space-size" | Read | The size of spacers
"space-style" | Read | The spacer style: `gtk.TOOLBAR_SPACE_EMPTY` or `gtk.TOOLBAR_SPACE_LINE`

## gtk.Toolbar Child Properties

"expand" | Read-Write | If `True`, the item should receive extra space when the toolbar grows. Available in GTK+ 2.4 and above.

## gtk.Toolbar Signal Prototypes

gobject.GObject Signal Prototypes

gtk.Object Signal Prototypes

gtk.Widget Signal Prototypes

gtk.Container Signal Prototypes

"focus-home-or-end | `def callback(`toolbar`, `focus_home`, `user_param1`, `...`)`
"move-focus | `def callback(`toolbar`, `dir`, `user_param1`, `...`)`
"orientation-changed" | `def callback(`toolbar`, `orientation`, `user_param1`, `...`)`
"popup-context-menu" | `def callback(`toolbar`, `x`, `y`, `button`, `user_param1`, `...`)`
"style-changed" | `def callback(`toolbar`, `style`, `user_param1`, `...`)`

## Description

A `gtk.Toolbar` is a subclass of `gtk.Container` that holds and manages a set of buttons and widgets in a horizontal or vertical bar. A `gtk.Toolbar` is usually used in an application as an alternative to a menu to provide a more direct means to activate dialogs or set options. Items in the toolbar can be visibly grouped by adding space between the elements. The toolbar style can be set to display only icons, only text or both icons and text. Each toolbar item has an associated `gtk.Tooltips` to provide a brief description of the items purpose.

In `PyGTK` 2.4 the interface of the `gtk.Toolbar` has changed to take advantage of the new `gtk.ToolItem` widgets. The following describes the new features.

A toolbar can contain instances of a subclass of `gtk.ToolItem` (`gtk.ToolButton`, `gtk.RadioToolButton`, `gtk.ToggleToolButton` and `gtk.SeparatorToolItem`). To add a `gtk.ToolItem` to the a toolbar, use the `insert`() method. To remove an item from the toolbar use the `gtk.Container.remove`() method. To add a button to the toolbar, add an instance of `gtk.ToolButton`. Toolbar items can be visually grouped by adding instances of `gtk.SeparatorToolItem` to the toolbar. If a `gtk.SeparatorToolItem` has the "expand" property set to `True` and the "draw" property set to `False` the effect is to force all following items to the end of the toolbar. Creating a context menu for the toolbar can be done by connecting to the "popup-context-menu" signal.

## Constructor

        gtk.Toolbar()

Returns : | a new `gtk.Toolbar` widget

Creates a new `gtk.Toolbar` widget.

## Methods

### gtk.Toolbar.insert

        def insert(item, pos)

`item` : | a `gtk.ToolItem`
`pos` : | the position of the new item

### Note

This method is available in PyGTK 2.4 and above

The `insert`() method inserts the `gtk.ToolItem` specified by `item` into the toolbar at the position specified by `pos`. If `pos` is 0 `item` is prepended to the start of the toolbar. If `pos` is negative, `item` is appended to the end of the toolbar.

### gtk.Toolbar.get_item_index

        def get_item_index(item)

`item` : | a `gtk.ToolItem` that is a child of the toolbar
Returns : | the position of item on the toolbar.

### Note

This method is available in PyGTK 2.4 and above

The `get_item_index`() method returns the position (starting from 0) on the toolbar of the `gtk.ToolItem` specified by `item`. It is an error if `item` is not a child of the toolbar.

### gtk.Toolbar.get_n_items

        def get_n_items()

Returns : | the number of items on the toolbar

### Note

This method is available in PyGTK 2.4 and above

The `get_n_items`() method returns the number of items on the toolbar.

### gtk.Toolbar.get_nth_item

        def get_nth_item(n)

`n` : | a position on the toolbar
Returns : | The `gtk.ToolItem` on the toolbar at position `n`, or `None` if there isn't an item at position `n`

### Note

This method is available in PyGTK 2.4 and above

The `get_nth_item`() method returns the toolbar `gtk.ToolItem` at the position specified by `n`, or `None` if the toolbar does not contain an item at position `n`.

### gtk.Toolbar.get_drop_index

        def get_drop_index(x, y)

`x` : | the x coordinate of a point on the toolbar
`y` : | the y coordinate of a point on the toolbar
Returns : | The toolbar position corresponding to the point (`x`, `y`).

### Note

This method is available in PyGTK 2.4 and above

The `get_drop_index`() method returns the position on the toolbar corresponding to the point specified by `x` and `y`. This is useful when dragging items to the toolbar. This method returns the position index where a new item should be inserted.

The `x` and `y` coordinates are relative to the toolbar.

### gtk.Toolbar.set_drop_highlight_item

        def set_drop_highlight_item(tool_item, index)

`tool_item` : | a `gtk.ToolItem`, or `None` to turn off highlighting
`index` : | a position index on the toolbar

### Note

This method is available in PyGTK 2.4 and above

The `set_drop_highlight_item`() method highlights the toolbar to give an idea of what it would look like if the `gtk.ToolItem` specified by `tool_item` was added at the position specified by `index`. If `tool_item` is `None`, highlighting is turned off and `index` is ignored.

The `tool_item` passed to this method must not be part of any widget hierarchy. When an item is set as drop highlight item it can not added to any widget hierarchy or used as highlight item for another toolbar.

### gtk.Toolbar.set_show_arrow

        def set_show_arrow(show_arrow)

`show_arrow` : | if `True`, show an arrow to indicate menu overflow

### Note

This method is available in PyGTK 2.4 and above

The `set_show_arrow`() method sets the "show-arrow" property to the value of `show_arrow`. If `show_arrow` is `True` an arrow is displayed (for an overflow menu) when the toolbar doesn't have room for all items on it. Items that are not displayed due to a lack of room are available through the overflow menu.

### gtk.Toolbar.get_show_arrow

        def get_show_arrow()

Returns : | `True` if an overflow menu can be used

### Note

This method is available in PyGTK 2.4 and above

The `get_show_arrow`() method returns the value of the "show-arrow" property. If "show-arrow" is `True` the toolbar has an overflow menu. See the `set_show_arrow()` method for more information.

### gtk.Toolbar.get_relief_style

        def get_relief_style()

Returns : | the relief style of buttons on the toolbar

### Note

This method is available in PyGTK 2.4 and above

The `get_relief_style`() method returns the relief style of buttons on the toolbar. See the `gtk.Button.set_relief()` method for more information. The return value will be one of:

- `gtk.RELIEF_NORMAL`
- `gtk.RELIEF_HALF`
- `gtk.RELIEF_NONE`

### gtk.Toolbar.append_item

        def append_item(text, tooltip_text, tooltip_private_text, icon, callback, user_data=None)

`text` : | the text label or `None`
`tooltip_text` : | the tooltip text or `None`
`tooltip_private_text` : | the private tooltip text or `None`
`icon` : | a `gtk.Widget` or `None`
`callback` : | a callback function or method or `None`
`user_data` : | a user data object or `None`
Returns : | a `gtk.Button` widget

### Warning

This method is deprecated in PyGTK 2.4 and above

The `append_item`() method adds a new `gtk.Button` to the end (right or bottom) of the toolbar with:

- the label specified by `text`,
- the `gtk.Tooltips` text and private text specified by `tooltip_text` and `tooltip_private_text` respectively and
- an icon (or any `gtk.Widget`) specified by `icon`.

A reference to the new button is returned. When the button is clicked the function or method specified by `callback` will be called with the user data specified by `user_data`. All or any of the arguments can have the value `None`.

### gtk.Toolbar.prepend_item

        def prepend_item(text, tooltip_text, tooltip_private_text, icon, callback, user_data)

`text` : | the text label or `None`
`tooltip_text` : | the tooltip text or `None`
`tooltip_private_text` : | the private tooltip text or `None`
`icon` : | a `gtk.Widget` or `None`
`callback` : | a callback function or method or `None`
`user_data` : | a user data object or `None`
Returns : | a `gtk.Button` widget

### Warning

This method is deprecated in PyGTK 2.4 and above

The `prepend_item`() method adds a new `gtk.Button` to the beginning (left or top) of the toolbar with:

- the label specified by `text`,
- the `gtk.Tooltips` text and private text specified by `tooltip_text` and `tooltip_private_text` respectively and
- an icon (or any `gtk.Widget`) specified by `icon`.

A reference to the new button is returned. When the button is clicked the function or method specified by `callback` will be called with the user data specified by `user_data`. All or any of the arguments can have the value `None`.

### gtk.Toolbar.insert_item

        def insert_item(text, tooltip_text, tooltip_private_text, icon, callback, user_data, position)

`text` : | the text label or `None`
`tooltip_text` : | the tooltip text or `None`
`tooltip_private_text` : | the private tooltip text or `None`
`icon` : | a `gtk.Widget` or `None`
`callback` : | a callback function or method or `None`
`user_data` : | a user data object or `None`
`position` : | The position to insert the button or -1 to append
Returns : | a `gtk.Button` widget

### Warning

This method is deprecated in PyGTK 2.4 and above

The `insert_item`() method inserts a new `gtk.Button` the toolbar at the position specified by `position` with:

- the label specified by `text`,
- the `gtk.Tooltips` text and private text specified by `tooltip_text` and `tooltip_private_text` respectively and
- an icon (or any `gtk.Widget`) specified by `icon`.

A reference to the new button is returned. When the button is clicked the function or method specified by `callback` will be called with the user data specified by `user_data`. All or any of the arguments (except `position`) can have the value `None`. If `position` is negative the button will be appended to the toolbar.

### gtk.Toolbar.insert_stock

        def insert_stock(stock_id, tooltip_text, tooltip_private_text, callback, user_data, position)

`stock_id` : | the ID of the stock item to use as the button label and icon
`tooltip_text` : | the tooltip text or `None`
`tooltip_private_text` : | the private tooltip text or `None`
`callback` : | a callback function or method or `None`
`user_data` : | a user data object or `None`
`position` : | The position to insert the button or -1 to append
Returns : | a `gtk.Button` widget

### Warning

This method is deprecated in PyGTK 2.4 and above

The `insert_stock`() method inserts a new `gtk.Button` the toolbar at the position specified by `position` with:

- the stock item specified by `stock_id` used for the label text and icon,
- the `gtk.Tooltips` text and private text specified by `tooltip_text` and `tooltip_private_text` respectively.

A reference to the new button is returned. When the button is clicked the function or method specified by `callback` will be called with the user data specified by `user_data`. All or any of the arguments (except `position`) can have the value `None`. If `position` is negative the button will be appended to the toolbar. If `stock_id` is not a known stock item ID, it's inserted verbatim, except that underscores are used to mark mnemonic accelerators.

### gtk.Toolbar.append_space

        def append_space()

### Warning

This method is deprecated in PyGTK 2.4 and above

The `append_space`() method appends a space to the end of the toolbar.

### gtk.Toolbar.prepend_space

        def prepend_space()

### Warning

This method is deprecated in PyGTK 2.4 and above

The `prepend_space`() method prepends a space to the beginning of the toolbar.

### gtk.Toolbar.insert_space

        def insert_space(position)

`position` : | The position to insert the space or -1 to append

### Warning

This method is deprecated in PyGTK 2.4 and above

The `insert_space`() method inserts a space at the specified `position` in the toolbar.

### gtk.Toolbar.remove_space

        def remove_space(position)

`position` : | the index of the space to remove.

### Warning

This method is deprecated in PyGTK 2.4 and above

The `remove_space`() method removes a space from the specified `position`.

### gtk.Toolbar.append_element

        def append_element(type, widget, text, tooltip_text, tooltip_private_text, icon, callback, user_data)

`type` : | the type of `widget` - one of: `gtk.TOOLBAR_CHILD_SPACE`, `gtk.TOOLBAR_CHILD_BUTTON`, `gtk.TOOLBAR_CHILD_TOGGLEBUTTON`, `gtk.TOOLBAR_CHILD_RADIOBUTTON` or `gtk.TOOLBAR_CHILD_WIDGET`
`widget` : | a widget or `None`
`text` : | the text label or `None`
`tooltip_text` : | the tooltip text or `None`
`tooltip_private_text` : | the private tooltip text or `None`
`icon` : | a `gtk.Widget` or `None`
`callback` : | a callback function or method or `None`
`user_data` : | a user data object or `None`
Returns : | the new toolbar element as a `gtk.Widget`.

### Warning

This method is deprecated in PyGTK 2.4 and above

The `append_element`() method adds a new element of the specified `type` to the end (right or bottom) of the toolbar with the `gtk.Tooltips` text and private text specified by `tooltip_text` and `tooltip_private_text` respectively. The behavior of the method depends on the type of element being added:

`gtk.TOOLBAR_CHILD_WIDGET` | The specified `widget` is the element added to the toolbar. The `text`, `icon`, `callback` and `user_data` arguments are ignored.
`gtk.TOOLBAR_CHILD_BUTTON` | The string specified by `text` and the `gtk.Widget` specified by `icon` are used to create the label for a `gtk.Button` to add to the toolbar. The function or method specified by `callback` and the object specified by `user_data` are connected to the button's "clicked" signal. The `widget` argument must have the value `None`.
`gtk.TOOLBAR_CHILD_TOGGLEBUTTON` | The string specified by `text` and the `gtk.Widget` specified by `icon` are used to create the label for a `gtk.ToggleButton` to add to the toolbar. The function or method specified by `callback` and the object specified by `user_data` are connected to the button's "clicked" signal. The `widget` argument must have the value `None`.

`gtk.TOOLBAR_CHILD_RADIOBUTTON`

The string specified by `text` and the `gtk.Widget` specified by `icon` are used to create the label for a `gtk.RadioButton` to add to the toolbar. The `gtk.RadioButton` specified by `widget` is used to set the group for the radiobutton. If `widget` is `None` a new radiobutton group is created. The function or method specified by `callback` and the object specified by `user_data` are connected to the button's "clicked" signal.

`gtk.TOOLBAR_CHILD_SPACE` | A space element is added to the toolbar. The `widget` argument must have the value `None`. The `text`, `icon`, `tooltip_text`, `tooltip_private_text`, `callback` and `user_data` arguments are ignored.

The `text`, `icon`, `callback`, `user_data`, `tooltip_text` and `tooltip_private_text` arguments may have the value `None`.

### gtk.Toolbar.prepend_element

        def prepend_element(type, widget, text, tooltip_text, tooltip_private_text, icon, callback, user_data)

`type` : | the type of `widget` - one of: `gtk.TOOLBAR_CHILD_SPACE`, `gtk.TOOLBAR_CHILD_BUTTON`, `gtk.TOOLBAR_CHILD_TOGGLEBUTTON`, `gtk.TOOLBAR_CHILD_RADIOBUTTON` or `gtk.TOOLBAR_CHILD_WIDGET`
`widget` : | a widget or `None`
`text` : | the text label or `None`
`tooltip_text` : | the tooltip text or `None`
`tooltip_private_text` : | the private tooltip text or `None`
`icon` : | a `gtk.Widget` or `None`
`callback` : | a callback function or method or `None`
`user_data` : | a user data object or `None`
Returns : | the new toolbar element as a `gtk.Widget`.

### Warning

This method is deprecated in PyGTK 2.4 and above

The `prepend_element`() method adds a new element of the specified `type` to the beginning (left or top) of the toolbar with the `gtk.Tooltips` text and private text specified by `tooltip_text` and `tooltip_private_text` respectively. The behavior of the method depends on the type of element being added:

`gtk.TOOLBAR_CHILD_WIDGET` | The widget specified by `widget` is the element added to the toolbar, otherwise `widget` should be `None`. The `text`, `icon`, `callback` and `user_data` arguments are ignored.
`gtk.TOOLBAR_CHILD_BUTTON` | The string specified by `text` and the `gtk.Widget` specified by `icon` are used to create the label for a `gtk.Button` to add to the toolbar. The function or method specified by `callback` and the object specified by `user_data` are connected to the button's "clicked" signal. The `widget` argument must have the value `None`.
`gtk.TOOLBAR_CHILD_TOGGLEBUTTON` | The string specified by `text` and the `gtk.Widget` specified by `icon` are used to create the label for a `gtk.ToggleButton` to add to the toolbar. The function or method specified by `callback` and the object specified by `user_data` are connected to the button's "clicked" signal. The `widget` argument must have the value `None`.

`gtk.TOOLBAR_CHILD_RADIOBUTTON`

The string specified by `text` and the `gtk.Widget` specified by `icon` are used to create the label for a `gtk.RadioButton` to add to the toolbar. The `gtk.RadioButton` specified by `widget` is used to set the group for the radiobutton. If `widget` is `None` a new radiobutton group is created. The function or method specified by `callback` and the object specified by `user_data` are connected to the button's "clicked" signal.

`gtk.TOOLBAR_CHILD_SPACE` | A space element is added to the toolbar. The `widget` argument must have the value `None`. The `text`, `icon`, `tooltip_text`, `tooltip_private_text`, `callback` and `user_data` arguments are ignored.

The `text`, `icon`, `callback`, `user_data`, `tooltip_text` and `tooltip_private_text` arguments may have the value `None`.

### gtk.Toolbar.insert_element

        def insert_element(type, widget, text, tooltip_text, tooltip_private_text, icon, callback, user_data, position)

`type` : | the type of `widget` - one of: `gtk.TOOLBAR_CHILD_SPACE`, `gtk.TOOLBAR_CHILD_BUTTON`, `gtk.TOOLBAR_CHILD_TOGGLEBUTTON`, `gtk.TOOLBAR_CHILD_RADIOBUTTON` or `gtk.TOOLBAR_CHILD_WIDGET`
`widget` : | a widget or `None`
`text` : | the text label or `None`
`tooltip_text` : | the tooltip text or `None`
`tooltip_private_text` : | the private tooltip text or `None`
`icon` : | a `gtk.Widget` or `None`
`callback` : | a callback function or method or `None`
`user_data` : | a user data object or `None`
`position` : | the position to insert the new element at.
Returns : | the new toolbar element as a `gtk.Widget`.

### Warning

This method is deprecated in PyGTK 2.4 and above

The `insert_element`() method adds a new element of the specified `type` at the specified `position` in the toolbar with the `gtk.Tooltips` text and private text specified by `tooltip_text` and `tooltip_private_text` respectively. The behavior of the method depends on the type of element being added:

`gtk.TOOLBAR_CHILD_WIDGET` | The widget specified by `widget` is the element added to the toolbar, otherwise `widget` should be `None`. The `text`, `icon`, `callback` and `user_data` arguments are ignored.
`gtk.TOOLBAR_CHILD_BUTTON` | The string specified by `text` and the `gtk.Widget` specified by `icon` are used to create the label for a `gtk.Button` to add to the toolbar. The function or method specified by `callback` and the object specified by `user_data` are connected to the button's "clicked" signal. The `widget` argument must have the value `None`.
`gtk.TOOLBAR_CHILD_TOGGLEBUTTON` | The string specified by `text` and the `gtk.Widget` specified by `icon` are used to create the label for a `gtk.ToggleButton` to add to the toolbar. The function or method specified by `callback` and the object specified by `user_data` are connected to the button's "clicked" signal. The `widget` argument must have the value `None`.

`gtk.TOOLBAR_CHILD_RADIOBUTTON`

The string specified by `text` and the `gtk.Widget` specified by `icon` are used to create the label for a `gtk.RadioButton` to add to the toolbar. The `gtk.RadioButton` specified by `widget` is used to set the group for the radiobutton. If `widget` is `None` a new radiobutton group is created. The function or method specified by `callback` and the object specified by `user_data` are connected to the button's "clicked" signal.

`gtk.TOOLBAR_CHILD_SPACE` | A space element is added to the toolbar. The `widget` argument must have the value `None`. The `text`, `icon`, `tooltip_text`, `tooltip_private_text`, `callback` and `user_data` arguments are ignored.

The `text`, `icon`, `callback`, `user_data`, `tooltip_text` and `tooltip_private_text` arguments may have the value `None`.

### gtk.Toolbar.append_widget

        def append_widget(widget, tooltip_text, tooltip_private_text)

`widget` : | a `gtk.Widget` to add to the toolbar.
`tooltip_text` : | the tooltip text or `None`
`tooltip_private_text` : | the private tooltip text or `None`

### Warning

This method is deprecated in PyGTK 2.4 and above

The `append_widget`() method adds the specified `widget` to the end (right or bottom) of the toolbar. `tooltip_text` and `tooltip_private_text` specify the tooltip text and private text respectively.

### gtk.Toolbar.prepend_widget

        def prepend_widget(widget, tooltip_text, tooltip_private_text)

`widget` : | a `gtk.Widget` to add to the toolbar.
`tooltip_text` : | the tooltip text or `None`
`tooltip_private_text` : | the private tooltip text or `None`

### Warning

This method is deprecated in PyGTK 2.4 and above

The `prepend_widget`() method adds the specified `widget` to the start (left or top) of the toolbar. `tooltip_text` and `tooltip_private_text` specify the tooltip text and private text respectively.

### gtk.Toolbar.insert_widget

        def insert_widget(widget, tooltip_text, tooltip_private_text, position)

`widget` : | a `gtk.Widget` to add to the toolbar.
`tooltip_text` : | the tooltip text or `None`
`tooltip_private_text` : | the private tooltip text or `None`
`position` : | the position to insert this widget at.

### Warning

This method is deprecated in PyGTK 2.4 and above

The `insert_widget`() method adds the specified `widget` at the specified `position` in the toolbar. `tooltip_text` and `tooltip_private_text` specify the tooltip text and private text respectively.

### gtk.Toolbar.set_orientation

        def set_orientation(orientation)

`orientation` : | the new orientation either `gtk.ORIENTATION_HORIZONTAL` or `gtk.ORIENTATION_VERTICAL`

The `set_orientation`() method sets the "orientation" property to the value of `orientation`. The value of orientation is either `gtk.ORIENTATION_HORIZONTAL` or `gtk.ORIENTATION_VERTICAL`

### gtk.Toolbar.set_style

        def set_style(style)

`style` : | the new style - one of: `gtk.TOOLBAR_ICONS`, `gtk.TOOLBAR_TEXT`, `gtk.TOOLBAR_BOTH` or `gtk.TOOLBAR_BOTH_HORIZ`

The `set_style`() method sets the "toolbar-style" property to the value of `style`. The value of `style` must be one of the GTK Toolbar Style Constants. Setting the style overrides the user preferences for the toolbar style.

### Note

A `gtk.ToolItem` label will not be displayed if the toolbar style is `gtk.TOOLBAR_BOTH_HORIZ` and the `gtk.ToolItem` "is-important" property is `False` (the default). See the `gtk.ToolItem.set_is_important`() method for more information.

### gtk.Toolbar.set_icon_size

        def set_icon_size(icon_size)

`icon_size` : | The size of stock icons in the toolbar - one of: `gtk.ICON_SIZE_MENU`, `gtk.ICON_SIZE_SMALL_TOOLBAR`, `gtk.ICON_SIZE_LARGE_TOOLBAR`, `gtk.ICON_SIZE_BUTTON`, `gtk.ICON_SIZE_DND` or `gtk.ICON_SIZE_DIALOG`

### Warning

This method is deprecated in PyGTK 2.4 and above

The `set_icon_size`() method sets the size of stock icons in the toolbar to the value specified by `icon_size`. The value of `icon_size` must be one of:

- `gtk.ICON_SIZE_MENU`
- `gtk.ICON_SIZE_SMALL_TOOLBAR`
- `gtk.ICON_SIZE_LARGE_TOOLBAR`
- `gtk.ICON_SIZE_BUTTON`
- `gtk.ICON_SIZE_DND`, or
- `gtk.ICON_SIZE_DIALOG`

This method can be called both before and after adding the icons. Setting the icon size will override the user preferences for the default icon size.

### gtk.Toolbar.set_tooltips

        def set_tooltips(enable)

`enable` : | if `True` tooltips should be used

The `set_tooltips`() method enables or disables tooltips for the toolbar depending on the value of `enable`. If `enable` is `True`, tooltips will be used.

### gtk.Toolbar.unset_style

        def unset_style()

The `unset_style`() method unsets a toolbar style set with the `set_style`() method, allowing the user preferences to determine the toolbar style.

### gtk.Toolbar.unset_icon_size

        def unset_icon_size()

### Warning

This method is deprecated in PyGTK 2.4 and above

The `unset_icon_size`() method unsets toolbar icon size set with the `set_icon_size`(), allowing the user preferences to determine the icon size.

### gtk.Toolbar.get_orientation

        def get_orientation()

Returns : | the orientation

The `get_orientation`() method returns the value of the "orientation" property that determines the current orientation of the toolbar. See the `set_orientation`() method for more details.

### gtk.Toolbar.get_style

        def get_style()

Returns : | the current toolbar style

The `get_style`() method returns the value of the "toolbar-style" property. See the `set_style`() method for more details.

### gtk.Toolbar.get_icon_size

        def get_icon_size()

Returns : | the current icon size for the icons on the toolbar.

The `get_icon_size`() method returns the current icon size for the toolbar. See the `set_icon_size`() method for more details.

### gtk.Toolbar.get_tooltips

        def get_tooltips()

Returns : | `True` if tooltips are enabled

The `get_tooltips`() method returns `True` if tooltips are enabled. See the `set_tooltips`() method for more details.

## Signals

### The "focus-home-or-end" gtk.Toolbar Signal

        def callback(toolbar, focus_home, user_param1, ...)

`toolbar` : | the `gtk.Toolbar` which emitted the signal the object which received the signal.
`focus_home` : | `True` if the first item should be focused
`user_param1` : | the first user parameter (if any) specified with the `connect`() method
`...` : | additional user parameters (if any)
Returns : | `True` if the signal was handled, `False` if not

A keybinding signal used internally by GTK+. This signal can't be used in application code

### The "move-focus" gtk.Toolbar Signal

        def callback(toolbar, dir, arg1, user_param1, ...)

`toolbar` : | the `gtk.Toolbar` which emitted the signal the object which received the signal.
`dir` : | one of the GTK Direction Type Constants
`user_param1` : | the first user parameter (if any) specified with the `connect`() method
`...` : | additional user parameters (if any)
Returns : | `True` if the signal was handled, `False` if not

A keybinding signal used internally by GTK+. This signal can't be used in application code.

### The "orientation-changed" gtk.Toolbar Signal

        def callback(toolbar, orientation, user_param1, ...)

`toolbar` : | the toolbar that received the signal
`orientation` : | the new orientation
`user_param1` : | the first user parameter (if any) specified with the `connect`() method
`...` : | additional user parameters (if any)

The "orientation-changed" signal is emitted when the `orientation` of `toolbar` is changed.

### The "popup-context-menu" gtk.Toolbar Signal

        def callback(toolbar, x, y, button, user_param1, ...)

`toolbar` : | the toolbar that received the signal
`x` : | the x coordinate of the mouse event
`y` : | the u coordinate of the mouse event
`button` : | the number of the mouse button
`user_param1` : | the first user parameter (if any) specified with the `connect`() method
`...` : | additional user parameters (if any)
Returns : | `True` if the signal was handled

### Note

This signal is available in GTK+ 2.4 and above.

The "popup-context-menu" signal is emitted when the user right-clicks the toolbar or uses the keybinding to display a popup menu. Application developers should handle this signal if they want to display a context menu on the toolbar. The context-menu should appear at the coordinates given by `x` and `y`. The mouse button number is given by the `button` parameter. If the menu was popped up using the keyboard, `button` is -1.

### The "style-changed" gtk.Toolbar Signal

        def callback(toolbar, style, user_param1, ...)

`toolbar` : | the toolbar that received the signal
`style` : | the new style
`user_param1` : | the first user parameter (if any) specified with the `connect`() method
`...` : | additional user parameters (if any)

The "style-changed" signal is emitted when the `style` of `toolbar` is changed.

Prev | Up | Next
gtk.ToggleToolButton | Home | gtk.ToolButton