:right-sidebar: True ConstraintGuide =================================================================== .. currentmodule:: gi.repository.Gtk .. class:: ConstraintGuide(**properties: ~typing.Any) :no-contents-entry: Superclasses: :class:`~gi.repository.GObject.Object` Implemented Interfaces: :class:`~gi.repository.Gtk.ConstraintTarget` A ``GtkConstraintGuide`` is an invisible layout element in a ``GtkConstraintLayout``. The ``GtkConstraintLayout`` treats guides like widgets. They can be used as the source or target of a ``GtkConstraint``. Guides have a minimum, maximum and natural size. Depending on the constraints that are applied, they can act like a guideline that widgets can be aligned to, or like *flexible space*. Unlike a ``GtkWidget``, a ``GtkConstraintGuide`` will not be drawn. Constructors ------------ .. rst-class:: interim-class .. class:: ConstraintGuide :no-index: .. classmethod:: new() -> ~gi.repository.Gtk.ConstraintGuide Creates a new ``GtkConstraintGuide`` object. Methods ------- .. rst-class:: interim-class .. class:: ConstraintGuide :no-index: .. method:: get_max_size() -> tuple[int, int] Gets the maximum size of ``guide``. .. method:: get_min_size() -> tuple[int, int] Gets the minimum size of ``guide``. .. method:: get_name() -> str | None Retrieves the name set using :func:`~gi.repository.Gtk.ConstraintGuide.set_name`. .. method:: get_nat_size() -> tuple[int, int] Gets the natural size of ``guide``. .. method:: get_strength() -> ~gi.repository.Gtk.ConstraintStrength Retrieves the strength set using :func:`~gi.repository.Gtk.ConstraintGuide.set_strength`. .. method:: set_max_size(width: int, height: int) -> None Sets the maximum size of ``guide``. If ``guide`` is attached to a ``GtkConstraintLayout``, the constraints will be updated to reflect the new size. :param width: the new maximum width, or -1 to not change it :param height: the new maximum height, or -1 to not change it .. method:: set_min_size(width: int, height: int) -> None Sets the minimum size of ``guide``. If ``guide`` is attached to a ``GtkConstraintLayout``, the constraints will be updated to reflect the new size. :param width: the new minimum width, or -1 to not change it :param height: the new minimum height, or -1 to not change it .. method:: set_name(name: str | None = None) -> None Sets a name for the given ``GtkConstraintGuide``. The name is useful for debugging purposes. :param name: a name for the ``guide`` .. method:: set_nat_size(width: int, height: int) -> None Sets the natural size of ``guide``. If ``guide`` is attached to a ``GtkConstraintLayout``, the constraints will be updated to reflect the new size. :param width: the new natural width, or -1 to not change it :param height: the new natural height, or -1 to not change it .. method:: set_strength(strength: ~gi.repository.Gtk.ConstraintStrength) -> None Sets the strength of the constraint on the natural size of the given ``GtkConstraintGuide``. :param strength: the strength of the constraint Properties ---------- .. rst-class:: interim-class .. class:: ConstraintGuide :no-index: .. attribute:: props.max_height :type: int The maximum height of the guide. .. attribute:: props.max_width :type: int The maximum width of the guide. .. attribute:: props.min_height :type: int The minimum height of the guide. .. attribute:: props.min_width :type: int The minimum width of the guide. .. attribute:: props.name :type: str A name that identifies the ``GtkConstraintGuide``, for debugging. .. attribute:: props.nat_height :type: int The preferred, or natural, height of the guide. .. attribute:: props.nat_width :type: int The preferred, or natural, width of the guide. .. attribute:: props.strength :type: ~gi.repository.Gtk.ConstraintStrength The ``GtkConstraintStrength`` to be used for the constraint on the natural size of the guide.