ConstraintLayout
Superclasses: LayoutManager
, Object
Implemented Interfaces: Buildable
- Constructors:
ConstraintLayout(**properties)
new() -> Gtk.LayoutManager
Constructors
- class ConstraintLayout
- classmethod new() LayoutManager
Creates a new
GtkConstraintLayout
layout manager.
Methods
- class ConstraintLayout
- add_constraint(constraint: Constraint) None
Adds a constraint to the layout manager.
The
source
andtarget
properties ofconstraint
can be:set to
NULL
to indicate that the constraint refers to the widget usinglayout
set to the
Widget
usinglayout
set to a child of the
Widget
usinglayout
set to a
ConstraintGuide
that is part oflayout
The
layout
acquires the ownership ofconstraint
after calling this function.- Parameters:
constraint – a
Constraint
- add_constraints_from_description(lines: Sequence[str], hspacing: int, vspacing: int, views: dict[str, ConstraintTarget]) list[Constraint]
Creates a list of constraints from a VFL description.
This function is a convenience wrapper around
add_constraints_from_descriptionv
, using variadic arguments to populate the view/target map.- Parameters:
lines – an array of Visual Format Language lines defining a set of constraints
hspacing – default horizontal spacing value, or -1 for the fallback value
vspacing – default vertical spacing value, or -1 for the fallback value
views
- add_guide(guide: 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 ofguide
after calling this function.- Parameters:
guide – a
ConstraintGuide
object
- observe_constraints() 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.
- observe_guides() 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.
- remove_constraint(constraint: Constraint) None
Removes
constraint
from the layout manager, so that it no longer influences the layout.- Parameters:
constraint – a
Constraint
- remove_guide(guide: ConstraintGuide) None
Removes
guide
from the layout manager, so that it no longer influences the layout.- Parameters:
guide – a
ConstraintGuide
object