Gtk.Paned

g GObject.GInterface GObject.GInterface Gtk.Accessible Gtk.Accessible GObject.GInterface->Gtk.Accessible Gtk.AccessibleRange Gtk.AccessibleRange GObject.GInterface->Gtk.AccessibleRange Gtk.Buildable Gtk.Buildable GObject.GInterface->Gtk.Buildable Gtk.ConstraintTarget Gtk.ConstraintTarget GObject.GInterface->Gtk.ConstraintTarget Gtk.Orientable Gtk.Orientable GObject.GInterface->Gtk.Orientable GObject.InitiallyUnowned GObject.InitiallyUnowned Gtk.Widget Gtk.Widget GObject.InitiallyUnowned->Gtk.Widget GObject.Object GObject.Object GObject.Object->GObject.InitiallyUnowned Gtk.Accessible->Gtk.Widget Gtk.Paned Gtk.Paned Gtk.AccessibleRange->Gtk.Paned Gtk.Buildable->Gtk.Widget Gtk.ConstraintTarget->Gtk.Widget Gtk.Orientable->Gtk.Paned Gtk.Widget->Gtk.Paned

Example

../_images/Paned.png
Subclasses:

None

Methods

Inherited:

Gtk.Widget (181), GObject.Object (37), Gtk.Accessible (15), Gtk.Buildable (1), Gtk.Orientable (2)

Structs:

Gtk.WidgetClass (18), GObject.ObjectClass (5)

class

new (orientation)

get_end_child ()

get_position ()

get_resize_end_child ()

get_resize_start_child ()

get_shrink_end_child ()

get_shrink_start_child ()

get_start_child ()

get_wide_handle ()

set_end_child (child)

set_position (position)

set_resize_end_child (resize)

set_resize_start_child (resize)

set_shrink_end_child (resize)

set_shrink_start_child (resize)

set_start_child (child)

set_wide_handle (wide)

Virtual Methods

Inherited:

Gtk.Widget (25), GObject.Object (7), Gtk.Accessible (6), Gtk.Buildable (9), Gtk.AccessibleRange (1)

Properties

Inherited:

Gtk.Widget (34), Gtk.Accessible (1), Gtk.Orientable (1)

Name

Type

Flags

Short Description

end-child

Gtk.Widget

r/w/en

max-position

int

r/en

min-position

int

r/en

position

int

r/w/en

position-set

bool

r/w/en

resize-end-child

bool

r/w/en

resize-start-child

bool

r/w/en

shrink-end-child

bool

r/w/en

shrink-start-child

bool

r/w/en

start-child

Gtk.Widget

r/w/en

wide-handle

bool

r/w/en

Signals

Inherited:

Gtk.Widget (13), GObject.Object (1)

Name

Short Description

accept-position

Emitted to accept the current position of the handle when moving it using key bindings.

cancel-position

Emitted to cancel moving the position of the handle using key bindings.

cycle-child-focus

Emitted to cycle the focus between the children of the paned.

cycle-handle-focus

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

Emitted to move the handle with key bindings.

toggle-handle-focus

Emitted to accept the current position of the handle and then move focus to the next widget in the focus chain.

Fields

Inherited:

Gtk.Widget (13), GObject.Object (1)

Class Details

class Gtk.Paned(**kwargs)
Bases:

Gtk.Widget, Gtk.AccessibleRange, Gtk.Orientable

Abstract:

No

A widget with two panes, arranged either horizontally or vertically.

An example Gtk.Paned

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 [method`Gtk`.Paned.set_start_child] and [method`Gtk`.Paned.set_end_child]. 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 [class`Gtk`.Frame] 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 GtkPaned 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 [method`Gtk`.Paned.set_position].

CSS nodes

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

GtkPaned 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 are arranged based on the text direction, so in left-to-right mode, :first-child will select the leftmost child, while it will select the rightmost child in RTL layouts.

Creating a paned widget with minimum sizes.

```c Gtk.Widget *hpaned = Gtk.Paned.new (Gtk.Orientation.HORIZONTAL); Gtk.Widget *frame1 = Gtk.Frame.new (None); Gtk.Widget *frame2 = Gtk.Frame.new (None);

Gtk.Widget.set_size_request (hpaned, 200, -1);

Gtk.Paned.set_start_child (GTK_PANED (hpaned), frame1); Gtk.Paned.set_resize_start_child (GTK_PANED (hpaned), True); Gtk.Paned.set_shrink_start_child (GTK_PANED (hpaned), False); Gtk.Widget.set_size_request (frame1, 50, -1);

Gtk.Paned.set_end_child (GTK_PANED (hpaned), frame2); Gtk.Paned.set_resize_end_child (GTK_PANED (hpaned), False); Gtk.Paned.set_shrink_end_child (GTK_PANED (hpaned), False); Gtk.Widget.set_size_request (frame2, 50, -1); ```

classmethod new(orientation)[source]
Parameters:

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

Returns:

the newly created paned widget

Return type:

Gtk.Widget

Creates a new GtkPaned widget.

get_end_child()[source]
Returns:

the end child widget

Return type:

Gtk.Widget or None

Retrieves the end child of the given GtkPaned.

get_position()[source]
Returns:

the position of the divider, in pixels

Return type:

int

Obtains the position of the divider between the two panes.

get_resize_end_child()[source]
Returns:

true if the end child is resizable

Return type:

bool

Returns whether the [property`Gtk`.Paned:end-child] can be resized.

get_resize_start_child()[source]
Returns:

true if the start child is resizable

Return type:

bool

Returns whether the [property`Gtk`.Paned:start-child] can be resized.

get_shrink_end_child()[source]
Returns:

true if the end child is shrinkable

Return type:

bool

Returns whether the [property`Gtk`.Paned:end-child] can shrink.

get_shrink_start_child()[source]
Returns:

true if the start child is shrinkable

Return type:

bool

Returns whether the [property`Gtk`.Paned:start-child] can shrink.

get_start_child()[source]
Returns:

the start child widget

Return type:

Gtk.Widget or None

Retrieves the start child of the given GtkPaned.

get_wide_handle()[source]
Returns:

True if the paned should have a wide handle

Return type:

bool

Gets whether the separator should be wide.

set_end_child(child)[source]
Parameters:

child (Gtk.Widget or None) – the widget to add

Sets the end child of self to child.

If child is NULL, the existing child will be removed.

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_resize_end_child(resize)[source]
Parameters:

resize (bool) – true to let the end child be resized

Sets whether the [property`Gtk`.Paned:end-child] can be resized.

set_resize_start_child(resize)[source]
Parameters:

resize (bool) – true to let the start child be resized

Sets whether the [property`Gtk`.Paned:start-child] can be resized.

set_shrink_end_child(resize)[source]
Parameters:

resize (bool) – true to let the end child be shrunk

Sets whether the [property`Gtk`.Paned:end-child] can shrink.

set_shrink_start_child(resize)[source]
Parameters:

resize (bool) – true to let the start child be shrunk

Sets whether the [property`Gtk`.Paned:start-child] can shrink.

set_start_child(child)[source]
Parameters:

child (Gtk.Widget or None) – the widget to add

Sets the start child of self to child.

If child is NULL, the existing child will be removed.

set_wide_handle(wide)[source]
Parameters:

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

Sets whether the separator should be wide.

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

Emitted to accept the current position of the handle when moving it using key bindings.

This is a keybinding signal.

The default binding for this signal is <kbd>Return</kbd> or <kbd>Space</kbd>.

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

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.

This is a keybinding signal.

The default binding for this signal is <kbd>Escape</kbd>.

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

Emitted to cycle the focus between the children of the paned.

This is a keybinding signal.

The default binding is <kbd>F6</kbd>.

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

Emitted to cycle whether the paned should grab focus to allow the user to change position of the handle by using key bindings.

This is a keybinding signal.

The default binding for this signal is <kbd>F8</kbd>.

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

move-handle

Flags:

RUN_LAST, ACTION

Parameters:
Return type:

bool

Emitted to move the handle with key bindings.

This is a keybinding signal.

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

Emitted to accept the current position of the handle and then move focus to the next widget in the focus chain.

This is a keybinding signal.

The default binding is <kbd>Tab</kbd>.

Property Details

Gtk.Paned.props.end_child
Name:

end-child

Type:

Gtk.Widget

Default Value:

None

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

The second child.

Gtk.Paned.props.max_position
Name:

max-position

Type:

int

Default Value:

2147483647

Flags:

READABLE, EXPLICIT_NOTIFY

The largest possible value for the [property`Gtk`.Paned:position] property.

This property is derived from the size and shrinkability of the widget’s children.

Gtk.Paned.props.min_position
Name:

min-position

Type:

int

Default Value:

0

Flags:

READABLE, EXPLICIT_NOTIFY

The smallest possible value for the [property`Gtk`.Paned:position] property.

This property is derived from the size and shrinkability of the widget’s children.

Gtk.Paned.props.position
Name:

position

Type:

int

Default Value:

0

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

Position of the separator in pixels, from the left/top.

Gtk.Paned.props.position_set
Name:

position-set

Type:

bool

Default Value:

False

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

Whether the [property`Gtk`.Paned:position] property has been set.

Gtk.Paned.props.resize_end_child
Name:

resize-end-child

Type:

bool

Default Value:

True

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

Determines whether the second child expands and shrinks along with the paned widget.

Gtk.Paned.props.resize_start_child
Name:

resize-start-child

Type:

bool

Default Value:

True

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

Determines whether the first child expands and shrinks along with the paned widget.

Gtk.Paned.props.shrink_end_child
Name:

shrink-end-child

Type:

bool

Default Value:

True

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

Determines whether the second child can be made smaller than its requisition.

Gtk.Paned.props.shrink_start_child
Name:

shrink-start-child

Type:

bool

Default Value:

True

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

Determines whether the first child can be made smaller than its requisition.

Gtk.Paned.props.start_child
Name:

start-child

Type:

Gtk.Widget

Default Value:

None

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

The first child.

Gtk.Paned.props.wide_handle
Name:

wide-handle

Type:

bool

Default Value:

False

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

Whether the GtkPaned should provide a stronger visual separation.

For example, this could be set when a paned contains two [class`Gtk`.Notebook]s, whose tab rows would otherwise merge visually.