Gtk.BoxLayout

g GObject.GInterface GObject.GInterface Gtk.Orientable Gtk.Orientable GObject.GInterface->Gtk.Orientable GObject.Object GObject.Object Gtk.LayoutManager Gtk.LayoutManager GObject.Object->Gtk.LayoutManager Gtk.BoxLayout Gtk.BoxLayout Gtk.LayoutManager->Gtk.BoxLayout Gtk.Orientable->Gtk.BoxLayout

Subclasses:

None

Methods

Inherited:

Gtk.LayoutManager (6), GObject.Object (37), Gtk.Orientable (2)

Structs:

GObject.ObjectClass (5)

class

new (orientation)

get_baseline_child ()

get_baseline_position ()

get_homogeneous ()

get_spacing ()

set_baseline_child (child)

set_baseline_position (position)

set_homogeneous (homogeneous)

set_spacing (spacing)

Virtual Methods

Inherited:

Gtk.LayoutManager (6), GObject.Object (7)

Properties

Inherited:

Gtk.Orientable (1)

Name

Type

Flags

Short Description

baseline-child

int

r/w/en

baseline-position

Gtk.BaselinePosition

r/w/en

homogeneous

bool

r/w/en

spacing

int

r/w/en

Signals

Inherited:

GObject.Object (1)

Fields

Inherited:

GObject.Object (1)

Class Details

class Gtk.BoxLayout(**kwargs)
Bases:

Gtk.LayoutManager, Gtk.Orientable

Abstract:

No

Structure:

Gtk.BoxLayoutClass

GtkBoxLayout is a layout manager that arranges children in a single row or column.

Whether it is a row or column depends on the value of its [property`Gtk`.Orientable:orientation] property. Within the other dimension all children all allocated the same size. The GtkBoxLayout will respect the [property`Gtk`.Widget:halign] and [property`Gtk`.Widget:valign] properties of each child widget.

If you want all children to be assigned the same size, you can use the [property`Gtk`.BoxLayout:homogeneous] property.

If you want to specify the amount of space placed between each child, you can use the [property`Gtk`.BoxLayout:spacing] property.

classmethod new(orientation)[source]
Parameters:

orientation (Gtk.Orientation) – the orientation for the new layout

Returns:

a new box layout

Return type:

Gtk.LayoutManager

Creates a new GtkBoxLayout.

get_baseline_child()[source]
Returns:

the index of the child that determines the baseline in vertical layout, or -1

Return type:

int

Gets the value set by Gtk.BoxLayout.set_baseline_child().

New in version 4.12.

get_baseline_position()[source]
Returns:

the baseline position

Return type:

Gtk.BaselinePosition

Gets the value set by Gtk.BoxLayout.set_baseline_position().

get_homogeneous()[source]
Returns:

True if the layout is homogeneous

Return type:

bool

Returns whether the layout is set to be homogeneous.

get_spacing()[source]
Returns:

the spacing of the layout

Return type:

int

Returns the space that self puts between children.

set_baseline_child(child)[source]
Parameters:

child (int) – the child position, or -1

Sets the index of the child that determines the baseline in vertical layout.

New in version 4.12.

set_baseline_position(position)[source]
Parameters:

position (Gtk.BaselinePosition) – a GtkBaselinePosition

Sets the baseline position of a box layout.

The baseline position affects only horizontal boxes with at least one baseline aligned child. If there is more vertical space available than requested, and the baseline is not allocated by the parent then the given position is used to allocate the baseline within the extra space available.

set_homogeneous(homogeneous)[source]
Parameters:

homogeneous (bool) – True to set the box layout as homogeneous

Sets whether the box layout will allocate the same size to all children.

set_spacing(spacing)[source]
Parameters:

spacing (int) – the spacing to apply between children

Sets how much spacing to put between children.

Property Details

Gtk.BoxLayout.props.baseline_child
Name:

baseline-child

Type:

int

Default Value:

-1

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

The child that determines the baseline of the box in vertical layout.

If the child does baseline positioning, then its baseline is lined up with the baseline of the box. If it doesn’t, then the bottom edge of the child is used.

New in version 4.12.

Gtk.BoxLayout.props.baseline_position
Name:

baseline-position

Type:

Gtk.BaselinePosition

Default Value:

Gtk.BaselinePosition.CENTER

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

The position of the allocated baseline within the extra space allocated to each child.

This property is only relevant for horizontal layouts containing at least one child with a baseline alignment.

Gtk.BoxLayout.props.homogeneous
Name:

homogeneous

Type:

bool

Default Value:

False

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

Whether the box layout should distribute the available space equally among the children.

Gtk.BoxLayout.props.spacing
Name:

spacing

Type:

int

Default Value:

0

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

The space to put between the children.