gtk.ToolPalette
Prev | The gtk Class Reference | Next

## gtk.ToolPalette

gtk.ToolPalette — a tool palette with categories (new in PyGTK 2.22)

## Synopsis

    class gtk.ToolPalette(gtk.Container):
        gtk.ToolPalette()
        def set_group_position(group, position)
        def set_exclusive(group, exclusive)
        def set_expand(group, expand)
        def get_group_position(group)
        def get_exclusive(group)
        def get_expand(group)
        def set_icon_size(icon_size)
        def unset_icon_size()
        def set_style(style)
        def unset_style()
        def get_icon_size()
        def get_style()
        def get_drop_item(x, y)
        def get_drop_group(x, y)
        def get_drag_item(selection)
        def set_drag_source(targets)
        def add_drag_dest(widget, flags, targets, actions)
        def get_hadjustment()
        def get_vadjustment()

## Ancestry

    +-- GObject
      +-- gtk.Object
        +-- gtk.Widget
          +-- gtk.Container
            +-- gtk.ToolPalette

## Implemented Interfaces

`gtk.ToolPalette` implements `atk.ImplementorIFace`, `gtk.Buildable`,

## gtk.ToolPalette Properties

gtk.Object Properties

gtk.Widget Properties

gtk.Container Properties

"icon-size" | Read-Write | Whether the group has been collapsed and items are hidden. Default value: `False`. This property is available in GTK+ 2.20 and above.
"icon-size-set" | Read-Write | Ellipsize for item group headers. Default value: `pango.ELLIPSIZE_NONE`. This property is available in GTK+ 2.20 and above.
"toolbar-style" | Read-Write | Relief of the group header button. Default value: `gtk.RELIEF_NORMAL`. This property is available in GTK+ 2.20 and above.

## gtk.ToolPalette Child Properties

"exclusive" | Read-Write | Whether the item should receive extra space when the group grows. Default value: `False`. This property is available in GTK+ 2.20 and above.
"expand" | Read-Write | Whether the item should fill the available space. Default value: `True`. This property is available in GTK+ 2.20 and above.

## gtk.ToolPalette Style Properties

gtk.Widget Style Properties

## gtk.ToolPalette Signal Prototypes

gobject.GObject Signal Prototypes

gtk.Object Signal Prototypes

gtk.Widget Signal Prototypes

gtk.Container Signal Prototypes

"set-scroll-adjustments" | `def callback(`toolpalette`, `hadjustment`, `vadjustment`, `user_param1`, `...`)`

## Description

### Note

This widget is available in PyGTK 2.22 and above.

A `gtk.ToolPalette` is used together with `gtk.ToolPalette` to add `gtk.ToolItem` objects to a palette like container with different categories and drag and drop support.

## Constructor

        gtk.ToolPalette()

Returns : | a new `gtk.ToolPalette`

### Note

This constructor is available in PyGTK 2.22 and above.

Creates a new tool palette.

## Methods

### gtk.ToolPalette.set_group_position

        def set_group_position(group, position)

`group` : | a `gtk.ToolPalette` which is a child of palette
`position` : | a new index for group

### Note

This method is available in PyGTK 2.22 and above.

The `set_group_position`() method sets the position of the group as an index of the tool palette. If position is 0 the group will become the first child, if position is -1 it will become the last child.

### gtk.ToolPalette.set_exclusive

        def set_exclusive(group, exclusive)

`group` : | a `gtk.ToolPalette` which is a child of palette
`exclusive` : | whether the group should be exclusive or not

### Note

This method is available in PyGTK 2.22 and above.

Sets whether the group should be exclusive or not. If an exclusive group is expanded all other groups are collapsed.

### gtk.ToolPalette.set_expand

        def set_expand(group, expand)

`group` : | a `gtk.ToolPalette` which is a child of palette
`expand` : | whether the group should be given extra space

### Note

This method is available in PyGTK 2.22 and above.

Sets whether the group should be given extra space.

### gtk.ToolPalette.get_group_position

        def get_group_position(group)

`group` : | a `gtk.ToolPalette`
Returns : | the index of group or -1 if `group` is not a child of `palette`

### Note

This method is available in PyGTK 2.22 and above.

Gets the position of `group` in `palette` as index. See `gtk.ToolPalette.set_group_position`.

### gtk.ToolPalette.get_exclusive

        def get_exclusive(group)

`group` : | a `gtk.ToolPalette` which is a child of palette
Returns : | `True` if `group` is exclusive

### Note

This method is available in PyGTK 2.22 and above.

Gets whether `group` is exclusive or not. See `gtk.ToolPalette.set_exclusive`.

### gtk.ToolPalette.get_expand

        def get_expand(group)

`group` : | a `gtk.ToolPalette` which is a child of palette
Returns : | `True` if group should be given extra space, `False` otherwise

### Note

This method is available in PyGTK 2.22 and above.

Gets whether group should be given extra space. See `gtk.ToolPalette.set_expand`.

### gtk.ToolPalette.set_icon_size

        def set_icon_size(icon_size)

`icon_size` : | one of the GTK Icon Size Constants that icons in the tool palette shall have

### Note

This method is available in PyGTK 2.22 and above.

The `set_icon_size`() method sets the size of icons in the tool palette.

### gtk.ToolPalette.unset_icon_size

        def unset_icon_size()

### Note

This method is available in PyGTK 2.22 and above.

Unsets the tool palette icon size set with `gtk.ToolPalette.set_icon_size`, so that user preferences will be used to determine the icon size.

### gtk.ToolPalette.set_style

        def set_style(style)

`style` : | one of the GTK Toolbar Style Constants that items in the tool palette shall have

### Note

This method is available in PyGTK 2.22 and above.

The `set_style`() method sets the style (text, icons or both) of items in the tool palette.

### gtk.ToolPalette.unset_style

        def unset_style()

### Note

This method is available in PyGTK 2.22 and above.

Unsets a toolbar style set with `gtk.ToolPalette.set_style`, so that user preferences will be used to determine the toolbar style.

### gtk.ToolPalette.get_icon_size

        def get_icon_size()

Returns : | one of the GTK Icon Size Constants

### Note

This method is available in PyGTK 2.22 and above.

Gets the size of icons in the tool palette. See `gtk.ToolPalette.set_icon_size`.

### gtk.ToolPalette.get_style

        def get_style()

Returns : | one of the GTK Toolbar Style Constants

### Note

This method is available in PyGTK 2.22 and above.

Gets the style (icons, text or both) of items in the tool palette.

### gtk.ToolPalette.get_drop_item

        def get_drop_item(x, y)

`x` : | the x position
`y` : | the y position
Returns : | the `gtk.ToolItem` at position or `None` if there is no such item

### Note

This method is available in PyGTK 2.22 and above.

Gets the item at position (x, y). See `gtk.ToolPalette.get_drop_group`.

### gtk.ToolPalette.get_drop_group

        def get_drop_group(x, y)

`x` : | the x position
`y` : | the y position
Returns : | the `gtk.ToolPalette` at position or `None` if there is no such group

### Note

This method is available in PyGTK 2.22 and above.

Gets the group at position (x, y).

### gtk.ToolPalette.get_drag_item

        def get_drag_item(selection)

`selection` : | a `gtk.SelectionData`
Returns : | the dragged item in selection

### Note

This method is available in PyGTK 2.22 and above.

Get the dragged item from the selection. This could be a `gtk.ToolItem` or a `gtk.ToolPalette`.

### gtk.ToolPalette.set_drag_source

        def set_drag_source(targets)

`targets` : | the `GtkToolPaletteDragTarget`s which the widget should support

### Note

This method is available in PyGTK 2.22 and above.

The `set_drag_source`() method sets the tool palette as a drag source. Enables all groups and items in the tool palette as drag sources on button 1 and button 3 press with copy and move actions. See `gtk.Widget.drag_source_set`.

### gtk.ToolPalette.add_drag_dest

        def add_drag_dest(widget, flags, targets, actions)

`widget` : | a `gtk.Widget` which should be a drag destination for `palette`
`flags` : | the flags that specify what actions GTK+ should take for drops on that widget
`targets` : | the `GtkToolPaletteDragTarget`s which the widget should support
`actions` : | the `GdkDragAction`s which the widget should suppport

### Note

This method is available in PyGTK 2.22 and above.

Sets `palette` as drag source (see `gtk.ToolPalette.set_drag_source`) and sets `widget` as a drag destination for drags from `palette`. See `gtk.Widget.drag_dest_set`.

### gtk.ToolPalette.get_hadjustment

        def get_hadjustment()

Returns : | the horizontal adjustment of `palette`

### Note

This method is available in PyGTK 2.22 and above.

Gets the horizontal adjustment of the tool palette.

### gtk.ToolPalette.get_vadjustment

        def get_vadjustment()

Returns : | the vertical adjustment of `palette`

### Note

This method is available in PyGTK 2.22 and above.

Gets the vertical adjustment of the tool palette.

## Signals

### The "set-scroll-adjustments" gtk.ToolPalette Signal

        def callback(toolpalette, hadjustment , vadjustment , user_param1, ...)

`toolpalette` : | the toolpalette that received the signal
`hadjustment` : | the horizontal adjustment
`vadjustment` : | the vertical adjustment
`user_param1` : | the first user parameter (if any) specified with the `connect`() method
`...` : | additional user parameters (if any)

### Note

This signal is available in GTK+ 2.20 and above.

The "set-scroll-adjustments" signal is emitted when one or both adjustments (specified by `hadjustment` and `vadjustment`) are set on textview.

Prev | Up | Next
gtk.ToolItemGroup | Home | gtk.ToolShell