Basics
Guides
API Reference
Basics
Guides
API Reference
[31:7] extends: object
Arranges child widgets into a single row or column.
GtkBox from start to end.
Use [method@Gtk.Box.remove] to remove widgets from the GtkBox.
[method@Gtk.Box.insert_child_after] can be used to add a child at a
particular position. Use [method@Gtk.Box.set_homogeneous] to specify whether
or not all children of the GtkBox are forced to get the same amount of
space. Use [method@Gtk.Box.set_spacing] to determine how much space will be
minimally placed between all children in the GtkBox. Note that spacing is
added between the children. Use [method@Gtk.Box.reorder_child_after] to
move a child to a different place in the box. # CSS nodes GtkBox uses a
single CSS node with name box. # Accessibility Until GTK 4.10, GtkBox used
the [enum@Gtk.AccessibleRole.group] role. Starting from GTK 4.12, GtkBox
uses the [enum@Gtk.AccessibleRole.generic] role.
Box (orientation = null, spacing = null)
Creates a new box.
orientation is the box’s orientation.spacing is the number of pixels to place between children.toNativeHandle (Source)
Normalizes a constructor argument into a raw pointer carrier. Accepts a raw NativeHandle, a raw NativeBuffer returned from
fn.call(...), another generated wrapper exposinghandle(), or null. Returns null when the argument carries no pointer.
Source is the raw handle, raw buffer, wrapper, or null.A raw pointer carrier or null when no pointer is present.getLib ()
Returns the opened native library for this generated wrapper.
The opened native library.handle ()
Returns the wrapped NativeHandle.
The wrapped NativeHandle.isNull ()
Returns true when the wrapped handle is null.
A bool.describe ()
Returns a small string for debugging generated wrappers.
A string.asWidget ()
Wraps this handle as
Widget.
A Widget object.asAccessible ()
Wraps this handle as
Accessible.
A Accessible object.asBuildable ()
Wraps this handle as
Buildable.
A Buildable object.asConstraintTarget ()
Wraps this handle as
ConstraintTarget.
A ConstraintTarget object.asOrientable ()
Wraps this handle as
Orientable.
A Orientable object.getProperty (string Name)
Reads one generated property by name.
setProperty (string Name, Value)
Writes one generated property by name.
setBaselinechild (int Value)
The position of the child that determines the baseline. This is only relevant if the box is in vertical orientation.
Value is the new property value.None.setBaselineposition (string Value)
How to position baseline-aligned widgets if extra space is available.
Value is the new property value.None.setHomogeneous (bool Value)
Whether the children should all be the same size.
Value is the new property value.None.setSpacing (int Value)
The amount of space between children.
Value is the new property value.None.append (object child)
Adds a child at the end.
child is the widget to append.None.get_baseline_child ()
Gets the value set by [method@Gtk.Box.set_baseline_child].
get_baseline_position ()
Gets the value set by [method@Gtk.Box.set_baseline_position].
get_homogeneous ()
Returns whether the box is homogeneous. In a homogeneous box all children are the same size.
get_spacing ()
Gets the value set by [method@Gtk.Box.set_spacing].
insert_child_after (object child, object sibling)
Inserts a child at a specific position. The child is added after @sibling in the list of @box children. If @sibling is
NULL, the @child is placed at the beginning.
child is the widget to insert.sibling is the sibling after which to insert @child.None.prepend (object child)
Adds a child at the beginning.
child is the widget to prepend.None.remove (object child)
Removes a child widget from the box. The child must have been added before with [method@Gtk.Box.append], [method@Gtk.Box.prepend], or [method@Gtk.Box.insert_child_after].
child is the child to remove.None.reorder_child_after (object child, object sibling)
Moves a child to a different position. The child is moved to the position after @sibling in the list of @box children. If @sibling is
NULL, the child is placed at the beginning.
child is the widget to move, must be a child of @box.sibling is the sibling to move @child after.None.set_baseline_child (int child)
Sets the baseline child of a box. This affects only vertical boxes.
child is a child position, or -1.None.set_baseline_position (string position)
Sets the baseline position of a box. This 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 @position is used to allocate the baseline with respect to the extra space available.
position is the baseline position.None.set_homogeneous (bool homogeneous)
Sets whether or not all children are given equal space in the box.
homogeneous is true to create equal allotments, false for variable allotments.None.set_spacing (int spacing)
Sets the number of pixels to place between children.
spacing is the number of pixels to put between children.None.[369:14] static extends: object
Generated metadata helpers for Box class surfaces.
properties ()
Returns property metadata for
Box.
A list.
Aussom
Write once. Embed everywhere.
Copyright 2026 Austin Lehman. All rights reserved.