:right-sidebar: True ConstraintLayout =================================================================== .. currentmodule:: gi.repository.Gtk .. class:: ConstraintLayout(**properties: ~typing.Any) :no-contents-entry: Superclasses: :class:`~gi.repository.Gtk.LayoutManager`, :class:`~gi.repository.GObject.Object` Implemented Interfaces: :class:`~gi.repository.Gtk.Buildable` :Constructors: :: ConstraintLayout(**properties) new() -> Gtk.LayoutManager Constructors ------------ .. rst-class:: interim-class .. class:: ConstraintLayout :no-index: .. classmethod:: new() -> ~gi.repository.Gtk.LayoutManager Creates a new ``GtkConstraintLayout`` layout manager. Methods ------- .. rst-class:: interim-class .. class:: ConstraintLayout :no-index: .. method:: add_constraint(constraint: ~gi.repository.Gtk.Constraint) -> None Adds a constraint to the layout manager. The :obj:`~gi.repository.Gtk.Constraint.props.source` and :obj:`~gi.repository.Gtk.Constraint.props.target` properties of ``constraint`` can be: - set to ``NULL`` to indicate that the constraint refers to the widget using ``layout`` - set to the :obj:`~gi.repository.Gtk.Widget` using ``layout`` - set to a child of the :obj:`~gi.repository.Gtk.Widget` using ``layout`` - set to a :obj:`~gi.repository.Gtk.ConstraintGuide` that is part of ``layout`` The ``layout`` acquires the ownership of ``constraint`` after calling this function. :param constraint: a :obj:`~gi.repository.Gtk.Constraint` .. method:: add_constraints_from_description(lines: ~typing.Sequence[str], hspacing: int, vspacing: int, views: dict[str, ~gi.repository.Gtk.ConstraintTarget]) -> list[~gi.repository.Gtk.Constraint] Creates a list of constraints from a VFL description. This function is a convenience wrapper around :obj:`~gi.repository.Gtk.ConstraintLayout.add_constraints_from_descriptionv`, using variadic arguments to populate the view/target map. :param lines: an array of Visual Format Language lines defining a set of constraints :param hspacing: default horizontal spacing value, or -1 for the fallback value :param vspacing: default vertical spacing value, or -1 for the fallback value :param views: .. method:: add_guide(guide: ~gi.repository.Gtk.ConstraintGuide) -> None Adds a guide to ``layout``. A guide can be used as the source or target of constraints, like a widget, but it is not visible. The ``layout`` acquires the ownership of ``guide`` after calling this function. :param guide: a :obj:`~gi.repository.Gtk.ConstraintGuide` object .. method:: observe_constraints() -> ~gi.repository.Gio.ListModel Returns a ``GListModel`` to track the constraints that are part of the layout. Calling this function will enable extra internal bookkeeping to track constraints and emit signals on the returned listmodel. It may slow down operations a lot. Applications should try hard to avoid calling this function because of the slowdowns. .. method:: observe_guides() -> ~gi.repository.Gio.ListModel Returns a ``GListModel`` to track the guides that are part of the layout. Calling this function will enable extra internal bookkeeping to track guides and emit signals on the returned listmodel. It may slow down operations a lot. Applications should try hard to avoid calling this function because of the slowdowns. .. method:: remove_all_constraints() -> None Removes all constraints from the layout manager. .. method:: remove_constraint(constraint: ~gi.repository.Gtk.Constraint) -> None Removes ``constraint`` from the layout manager, so that it no longer influences the layout. :param constraint: a :obj:`~gi.repository.Gtk.Constraint` .. method:: remove_guide(guide: ~gi.repository.Gtk.ConstraintGuide) -> None Removes ``guide`` from the layout manager, so that it no longer influences the layout. :param guide: a :obj:`~gi.repository.Gtk.ConstraintGuide` object