BoxLayout#

class BoxLayout(**properties: Any)#

Superclasses: LayoutManager, Object

Implemented Interfaces: Orientable

Arranges children in a single row or column.

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

If you want all children to be assigned the same size, you can use the homogeneous property.

If you want to specify the amount of space placed between each child, you can use the spacing property.

Constructors#

class BoxLayout
classmethod new(orientation: Orientation) LayoutManager#

Creates a new GtkBoxLayout.

Parameters:

orientation – the orientation for the new layout

Methods#

class BoxLayout
get_baseline_child() int#

Gets the value set by set_baseline_child().

Added in version 4.12.

get_baseline_position() BaselinePosition#

Gets the value set by set_baseline_position().

get_homogeneous() bool#

Returns whether the layout is set to be homogeneous.

get_spacing() int#

Returns the space that box_layout puts between children.

set_baseline_child(child: int) None#

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

Added in version 4.12.

Parameters:

child – the child position, or -1

set_baseline_position(position: BaselinePosition) None#

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.

Parameters:

position – a GtkBaselinePosition

set_homogeneous(homogeneous: bool) None#

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

Parameters:

homogeneousTrue to set the box layout as homogeneous

set_spacing(spacing: int) None#

Sets how much spacing to put between children.

Parameters:

spacing – the spacing to apply between children

Properties#

class BoxLayout
props.baseline_child: int#

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.

Added in version 4.12.

props.baseline_position: BaselinePosition#

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.

props.homogeneous: bool#

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

props.spacing: int#

The space to put between the children.