Gtk.Paned

g Atk.ImplementorIface Atk.ImplementorIface Gtk.Widget Gtk.Widget Atk.ImplementorIface->Gtk.Widget GObject.GInterface GObject.GInterface GObject.GInterface->Atk.ImplementorIface Gtk.Buildable Gtk.Buildable GObject.GInterface->Gtk.Buildable Gtk.Orientable Gtk.Orientable GObject.GInterface->Gtk.Orientable GObject.InitiallyUnowned GObject.InitiallyUnowned GObject.InitiallyUnowned->Gtk.Widget GObject.Object GObject.Object GObject.Object->GObject.InitiallyUnowned Gtk.Buildable->Gtk.Widget Gtk.Container Gtk.Container Gtk.Paned Gtk.Paned Gtk.Container->Gtk.Paned Gtk.Orientable->Gtk.Paned Gtk.Widget->Gtk.Container

Example

../_images/Paned.png
Subclasses:

Gtk.HPaned, Gtk.VPaned

Methods

Inherited:

Gtk.Container (35), Gtk.Widget (278), GObject.Object (37), Gtk.Buildable (10), Gtk.Orientable (2)

Structs:

Gtk.ContainerClass (5), Gtk.WidgetClass (12), GObject.ObjectClass (5)

class

new (orientation)

add1 (child)

add2 (child)

get_child1 ()

get_child2 ()

get_handle_window ()

get_position ()

get_wide_handle ()

pack1 (child, resize, shrink)

pack2 (child, resize, shrink)

set_position (position)

set_wide_handle (wide)

Virtual Methods

Inherited:

Gtk.Container (10), Gtk.Widget (82), GObject.Object (7), Gtk.Buildable (10)

do_accept_position ()

do_cancel_position ()

do_cycle_child_focus (reverse)

do_cycle_handle_focus (reverse)

do_move_handle (scroll)

do_toggle_handle_focus ()

Properties

Inherited:

Gtk.Container (3), Gtk.Widget (39), Gtk.Orientable (1)

Name

Type

Flags

Short Description

max-position

int

r/en

Largest possible value for the “position” property

min-position

int

r/en

Smallest possible value for the “position” property

position

int

r/w/en

Position of paned separator in pixels (0 means all the way to the left/top)

position-set

bool

r/w/en

True if the Position property should be used

wide-handle

bool

r/w/en

Whether the paned should have a prominent handle

Child Properties

Name

Type

Default

Flags

Short Description

resize

bool

True

r/w

If True, the child expands and shrinks along with the paned widget

shrink

bool

True

r/w

If True, the child can be made smaller than its requisition

Style Properties

Inherited:

Gtk.Widget (17)

Name

Type

Default

Flags

Short Description

handle-size

int

5

d/r

Width of handle deprecated

Signals

Inherited:

Gtk.Container (4), Gtk.Widget (69), GObject.Object (1)

Name

Short Description

accept-position

The ::accept-position signal is a keybinding signal which gets emitted to accept the current position of the handle when moving it using key bindings.

cancel-position

The ::cancel-position signal is a keybinding signal which gets emitted to cancel moving the position of the handle using key bindings.

cycle-child-focus

The ::cycle-child-focus signal is a keybinding signal which gets emitted to cycle the focus between the children of the paned.

cycle-handle-focus

The ::cycle-handle-focus signal is a keybinding signal which gets emitted to cycle whether the paned should grab focus to allow the user to change position of the handle by using key bindings.

move-handle

The ::move-handle signal is a keybinding signal which gets emitted to move the handle when the user is using key bindings to move it.

toggle-handle-focus

The ::toggle-handle-focus is a keybinding signal which gets emitted to accept the current position of the handle and then move focus to the next widget in the focus chain.

Fields

Inherited:

Gtk.Container (4), Gtk.Widget (69), GObject.Object (1)

Name

Type

Access

Description

container

Gtk.Container

r

Class Details

class Gtk.Paned(**kwargs)
Bases:

Gtk.Container, Gtk.Orientable

Abstract:

No

Structure:

Gtk.PanedClass

Gtk.Paned has two panes, arranged either horizontally or vertically. The division between the two panes is adjustable by the user by dragging a handle.

Child widgets are added to the panes of the widget with Gtk.Paned.pack1() and Gtk.Paned.pack2(). The division between the two children is set by default from the size requests of the children, but it can be adjusted by the user.

A paned widget draws a separator between the two child widgets and a small handle that the user can drag to adjust the division. It does not draw any relief around the children or around the separator. (The space in which the separator is called the gutter.) Often, it is useful to put each child inside a Gtk.Frame with the shadow type set to Gtk.ShadowType.IN so that the gutter appears as a ridge. No separator is drawn if one of the children is missing.

Each child has two options that can be set, resize and shrink. If resize is true, then when the Gtk.Paned is resized, that child will expand or shrink along with the paned widget. If shrink is true, then that child can be made smaller than its requisition by the user. Setting shrink to False allows the application to set a minimum size. If resize is false for both children, then this is treated as if resize is true for both children.

The application can set the position of the slider as if it were set by the user, by calling Gtk.Paned.set_position().

CSS nodes
paned
├── <child>
├── separator[.wide]
╰── <child>

Gtk.Paned has a main CSS node with name paned, and a subnode for the separator with name separator. The subnode gets a .wide style class when the paned is supposed to be wide.

In horizontal orientation, the nodes of the children are always arranged from left to right. So :first-child will always select the leftmost child, regardless of text direction.

Creating a paned widget with minimum sizes.
GtkWidget *hpaned = gtk_paned_new (GTK_ORIENTATION_HORIZONTAL);
GtkWidget *frame1 = gtk_frame_new (NULL);
GtkWidget *frame2 = gtk_frame_new (NULL);
gtk_frame_set_shadow_type (GTK_FRAME (frame1), GTK_SHADOW_IN);
gtk_frame_set_shadow_type (GTK_FRAME (frame2), GTK_SHADOW_IN);

gtk_widget_set_size_request (hpaned, 200, -1);

gtk_paned_pack1 (GTK_PANED (hpaned), frame1, TRUE, FALSE);
gtk_widget_set_size_request (frame1, 50, -1);

gtk_paned_pack2 (GTK_PANED (hpaned), frame2, FALSE, FALSE);
gtk_widget_set_size_request (frame2, 50, -1);
classmethod new(orientation)[source]
Parameters:

orientation (Gtk.Orientation) – the paned’s orientation.

Returns:

a new Gtk.Paned.

Return type:

Gtk.Widget

Creates a new Gtk.Paned widget.

New in version 3.0.

add1(child)[source]
Parameters:

child (Gtk.Widget) – the child to add

Adds a child to the top or left pane with default parameters. This is equivalent to gtk_paned_pack1 (paned, child, FALSE, TRUE).

add2(child)[source]
Parameters:

child (Gtk.Widget) – the child to add

Adds a child to the bottom or right pane with default parameters. This is equivalent to gtk_paned_pack2 (paned, child, TRUE, TRUE).

get_child1()[source]
Returns:

first child, or None if it is not set.

Return type:

Gtk.Widget or None

Obtains the first child of the paned widget.

New in version 2.4.

get_child2()[source]
Returns:

second child, or None if it is not set.

Return type:

Gtk.Widget or None

Obtains the second child of the paned widget.

New in version 2.4.

get_handle_window()[source]
Returns:

the paned’s handle window.

Return type:

Gdk.Window

Returns the Gdk.Window of the handle. This function is useful when handling button or motion events because it enables the callback to distinguish between the window of the paned, a child and the handle.

New in version 2.20.

get_position()[source]
Returns:

position of the divider

Return type:

int

Obtains the position of the divider between the two panes.

get_wide_handle()[source]
Returns:

True if the paned should have a wide handle

Return type:

bool

Gets the Gtk.Paned :wide-handle property.

New in version 3.16.

pack1(child, resize, shrink)[source]
Parameters:
  • child (Gtk.Widget) – the child to add

  • resize (bool) – should this child expand when the paned widget is resized.

  • shrink (bool) – can this child be made smaller than its requisition.

Adds a child to the top or left pane.

pack2(child, resize, shrink)[source]
Parameters:
  • child (Gtk.Widget) – the child to add

  • resize (bool) – should this child expand when the paned widget is resized.

  • shrink (bool) – can this child be made smaller than its requisition.

Adds a child to the bottom or right pane.

set_position(position)[source]
Parameters:

position (int) – pixel position of divider, a negative value means that the position is unset.

Sets the position of the divider between the two panes.

set_wide_handle(wide)[source]
Parameters:

wide (bool) – the new value for the Gtk.Paned :wide-handle property

Sets the Gtk.Paned :wide-handle property.

New in version 3.16.

do_accept_position() virtual
Return type:

bool

do_cancel_position() virtual
Return type:

bool

do_cycle_child_focus(reverse) virtual
Parameters:

reverse (bool) –

Return type:

bool

do_cycle_handle_focus(reverse) virtual
Parameters:

reverse (bool) –

Return type:

bool

do_move_handle(scroll) virtual
Parameters:

scroll (Gtk.ScrollType) –

Return type:

bool

do_toggle_handle_focus() virtual
Return type:

bool

Signal Details

Gtk.Paned.signals.accept_position(paned)
Signal Name:

accept-position

Flags:

RUN_LAST, ACTION

Parameters:

paned (Gtk.Paned) – The object which received the signal

Return type:

bool

The ::accept-position signal is a keybinding signal which gets emitted to accept the current position of the handle when moving it using key bindings.

The default binding for this signal is Return or Space.

New in version 2.0.

Gtk.Paned.signals.cancel_position(paned)
Signal Name:

cancel-position

Flags:

RUN_LAST, ACTION

Parameters:

paned (Gtk.Paned) – The object which received the signal

Return type:

bool

The ::cancel-position signal is a keybinding signal which gets emitted to cancel moving the position of the handle using key bindings. The position of the handle will be reset to the value prior to moving it.

The default binding for this signal is Escape.

New in version 2.0.

Gtk.Paned.signals.cycle_child_focus(paned, reversed)
Signal Name:

cycle-child-focus

Flags:

RUN_LAST, ACTION

Parameters:
  • paned (Gtk.Paned) – The object which received the signal

  • reversed (bool) – whether cycling backward or forward

Return type:

bool

The ::cycle-child-focus signal is a keybinding signal which gets emitted to cycle the focus between the children of the paned.

The default binding is f6.

New in version 2.0.

Gtk.Paned.signals.cycle_handle_focus(paned, reversed)
Signal Name:

cycle-handle-focus

Flags:

RUN_LAST, ACTION

Parameters:
  • paned (Gtk.Paned) – The object which received the signal

  • reversed (bool) – whether cycling backward or forward

Return type:

bool

The ::cycle-handle-focus signal is a keybinding signal which gets emitted to cycle whether the paned should grab focus to allow the user to change position of the handle by using key bindings.

The default binding for this signal is f8.

New in version 2.0.

Gtk.Paned.signals.move_handle(paned, scroll_type)
Signal Name:

move-handle

Flags:

RUN_LAST, ACTION

Parameters:
Return type:

bool

The ::move-handle signal is a keybinding signal which gets emitted to move the handle when the user is using key bindings to move it.

New in version 2.0.

Gtk.Paned.signals.toggle_handle_focus(paned)
Signal Name:

toggle-handle-focus

Flags:

RUN_LAST, ACTION

Parameters:

paned (Gtk.Paned) – The object which received the signal

Return type:

bool

The ::toggle-handle-focus is a keybinding signal which gets emitted to accept the current position of the handle and then move focus to the next widget in the focus chain.

The default binding is Tab.

New in version 2.0.

Property Details

Gtk.Paned.props.max_position
Name:

max-position

Type:

int

Default Value:

2147483647

Flags:

READABLE, EXPLICIT_NOTIFY

The largest possible value for the position property. This property is derived from the size and shrinkability of the widget’s children.

New in version 2.4.

Gtk.Paned.props.min_position
Name:

min-position

Type:

int

Default Value:

0

Flags:

READABLE, EXPLICIT_NOTIFY

The smallest possible value for the position property. This property is derived from the size and shrinkability of the widget’s children.

New in version 2.4.

Gtk.Paned.props.position
Name:

position

Type:

int

Default Value:

0

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

Position of paned separator in pixels (0 means all the way to the left/top)

Gtk.Paned.props.position_set
Name:

position-set

Type:

bool

Default Value:

False

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

True if the Position property should be used

Gtk.Paned.props.wide_handle
Name:

wide-handle

Type:

bool

Default Value:

False

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

Setting this property to True indicates that the paned needs to provide stronger visual separation (e.g. because it separates between two notebooks, whose tab rows would otherwise merge visually).

New in version 3.16.