:right-sidebar: True BoxLayout =================================================================== .. currentmodule:: gi.repository.Gtk .. class:: BoxLayout(**properties: ~typing.Any) :no-contents-entry: Superclasses: :class:`~gi.repository.Gtk.LayoutManager`, :class:`~gi.repository.GObject.Object` Implemented Interfaces: :class:`~gi.repository.Gtk.Orientable` ``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 :obj:`~gi.repository.Gtk.Orientable.props.orientation` property. Within the other dimension all children all allocated the same size. The ``GtkBoxLayout`` will respect the :obj:`~gi.repository.Gtk.Widget.props.halign` and :obj:`~gi.repository.Gtk.Widget.props.valign` properties of each child widget. If you want all children to be assigned the same size, you can use the :obj:`~gi.repository.Gtk.BoxLayout.props.homogeneous` property. If you want to specify the amount of space placed between each child, you can use the :obj:`~gi.repository.Gtk.BoxLayout.props.spacing` property. Constructors ------------ .. rst-class:: interim-class .. class:: BoxLayout :no-index: .. classmethod:: new(orientation: ~gi.repository.Gtk.Orientation) -> ~gi.repository.Gtk.LayoutManager Creates a new ``GtkBoxLayout``. :param orientation: the orientation for the new layout Methods ------- .. rst-class:: interim-class .. class:: BoxLayout :no-index: .. method:: get_baseline_child() -> int Gets the value set by :func:`~gi.repository.Gtk.BoxLayout.set_baseline_child`. .. versionadded:: 4.12 .. method:: get_baseline_position() -> ~gi.repository.Gtk.BaselinePosition Gets the value set by :func:`~gi.repository.Gtk.BoxLayout.set_baseline_position`. .. method:: get_homogeneous() -> bool Returns whether the layout is set to be homogeneous. .. method:: get_spacing() -> int Returns the space that ``box_layout`` puts between children. .. method:: set_baseline_child(child: int) -> None Sets the index of the child that determines the baseline in vertical layout. .. versionadded:: 4.12 :param child: the child position, or -1 .. method:: set_baseline_position(position: ~gi.repository.Gtk.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. :param position: a ``GtkBaselinePosition`` .. method:: set_homogeneous(homogeneous: bool) -> None Sets whether the box layout will allocate the same size to all children. :param homogeneous: :const:`True` to set the box layout as homogeneous .. method:: set_spacing(spacing: int) -> None Sets how much spacing to put between children. :param spacing: the spacing to apply between children Properties ---------- .. rst-class:: interim-class .. class:: BoxLayout :no-index: .. attribute:: props.baseline_child :type: 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. .. versionadded:: 4.12 .. attribute:: props.baseline_position :type: ~gi.repository.Gtk.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. .. attribute:: props.homogeneous :type: bool Whether the box layout should distribute the available space equally among the children. .. attribute:: props.spacing :type: int The space to put between the children.