gtk.constraint
Module for [Constraint] class
Types 3
[gtk.constraint.Constraint] describes a constraint between attributes of two widgets, expressed as a linear equation.
The typical equation for a constraint is:
target.target_attr = source.source_attr × multiplier + constantEach [gtk.constraint.Constraint] is part of a system that will be solved by a [gtk.constraint_layout.ConstraintLayout] in order to allocate and position each child widget or guide.
The source and target, as well as their attributes, of a [gtk.constraint.Constraint] instance are immutable after creation.
Methods
Constraint self()Returns `this`, for use in `with` statements.ConstraintGidBuilder builder()Get builder for [gtk.constraint.Constraint] Returns: New builder objectdouble constant() @propertyGet `constant` property. Returns: The constant value to be added to the [gtk.constraint.Constraint.source].double multiplier() @propertyGet `multiplier` property. Returns: The multiplication factor to be applied to the [gtk.constraint.Constraint.source].gtk.types.ConstraintRelation relation() @propertyGet `relation` property. Returns: The order relation between the terms of the constraint.gtk.constraint_target.ConstraintTarget source() @propertyGet `source` property. Returns: The source of the constraint.gtk.types.ConstraintAttribute sourceAttribute() @propertyGet `sourceAttribute` property. Returns: The attribute of the [gtk.constraint.Constraint.source] read by the constraint.gtk.constraint_target.ConstraintTarget target() @propertyGet `target` property. Returns: The target of the constraint.gtk.types.ConstraintAttribute targetAttribute() @propertyGet `targetAttribute` property. Returns: The attribute of the [gtk.constraint.Constraint.target] set by the constraint.gtk.constraint.Constraint newConstant(gtk.constraint_target.ConstraintTarget target, gtk.types.ConstraintAttribute targetAttribute, gtk.types.ConstraintRelation relation, double constant, int strength)Creates a new constraint representing a relation between a layout attribute on a target and a constant value.double getConstant()Retrieves the constant factor added to the source attributes' value. Returns: a constant factordouble getMultiplier()Retrieves the multiplication factor applied to the source attribute's value. Returns: a multiplication factorgtk.types.ConstraintRelation getRelation()The order relation between the terms of the constraint. Returns: a relation typegtk.constraint_target.ConstraintTarget getSource()Retrieves the [gtk.constraint_target.ConstraintTarget] used as the source for the constraint.gtk.types.ConstraintAttribute getSourceAttribute()Retrieves the attribute of the source to be read by the constraint. Returns: the source's attributeint getStrength()Retrieves the strength of the constraint. Returns: the strength valuegtk.constraint_target.ConstraintTarget getTarget()Retrieves the [gtk.constraint_target.ConstraintTarget] used as the target for the constraint.gtk.types.ConstraintAttribute getTargetAttribute()Retrieves the attribute of the target to be set by the constraint. Returns: the target's attributebool isAttached()Checks whether the constraint is attached to a [gtk.constraint_layout.ConstraintLayout], and it is contributing to the layout. Returns: `TRUE` if the constraint is attachedbool isConstant()Checks whether the constraint describes a relation between an attribute on the [gtk.constraint.Constraint.target] and a constant value. Returns: `TRUE` if the constraint is a constant relationbool isRequired()Checks whether the constraint is a required relation for solving the constraint layout. Returns: true if the constraint is requiredConstructors
this(gtk.constraint_target.ConstraintTarget target, gtk.types.ConstraintAttribute targetAttribute, gtk.types.ConstraintRelation relation, gtk.constraint_target.ConstraintTarget source, gtk.types.ConstraintAttribute sourceAttribute, double multiplier, double constant, int strength)Creates a new constraint representing a relation between a layout attribute on a source and a layout attribute on a target.Methods
T constant(double propval)Set `constant` property. Params: propval = The constant value to be added to the [gtk.constraint.Constraint.source]. Returns: Builder instance for fluent chainingT multiplier(double propval)Set `multiplier` property. Params: propval = The multiplication factor to be applied to the [gtk.constraint.Constraint.source]. Returns: Builder instance for fluent chainingT relation(gtk.types.ConstraintRelation propval)Set `relation` property. Params: propval = The order relation between the terms of the constraint. Returns: Builder instance for fluent chainingT source(gtk.constraint_target.ConstraintTarget propval)Set `source` property. Params: propval = The source of the constraint.T sourceAttribute(gtk.types.ConstraintAttribute propval)Set `sourceAttribute` property. Params: propval = The attribute of the [gtk.constraint.Constraint.source] read by the constraint. Returns: Builder instance for fluent chainingT strength(int propval)Set `strength` property. Params: propval = The strength of the constraint.T target(gtk.constraint_target.ConstraintTarget propval)Set `target` property. Params: propval = The target of the constraint.T targetAttribute(gtk.types.ConstraintAttribute propval)Set `targetAttribute` property. Params: propval = The attribute of the [gtk.constraint.Constraint.target] set by the constraint. Returns: Builder instance for fluent chainingFluent builder for [gtk.constraint.Constraint]
Methods