Gtk.Constraint¶
- Subclasses:
None
Methods¶
- Inherited:
- Structs:
class |
|
class |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Virtual Methods¶
- Inherited:
Properties¶
Name |
Type |
Flags |
Short Description |
---|---|---|---|
r/w/co |
|||
r/w/co |
|||
r/w/co |
|||
r/w/co |
|||
r/w/co |
|||
r/w/co |
|||
r/w/co |
|||
r/w/co |
Signals¶
- Inherited:
Fields¶
- Inherited:
Class Details¶
- class Gtk.Constraint(**kwargs)¶
- Bases:
- Abstract:
No
- Structure:
GtkConstraint
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 + constant
Each
GtkConstraint
is part of a system that will be solved by a [class`Gtk`.ConstraintLayout] in order to allocate and position each child widget or guide.The source and target, as well as their attributes, of a
GtkConstraint
instance are immutable after creation.- classmethod new(target, target_attribute, relation, source, source_attribute, multiplier, constant, strength)[source]¶
- Parameters:
target (
Gtk.ConstraintTarget
orNone
) – the target of the constrainttarget_attribute (
Gtk.ConstraintAttribute
) – the attribute oftarget
to be setrelation (
Gtk.ConstraintRelation
) – the relation equivalence betweentarget_attribute
andsource_attribute
source (
Gtk.ConstraintTarget
orNone
) – the source of the constraintsource_attribute (
Gtk.ConstraintAttribute
) – the attribute ofsource
to be readmultiplier (
float
) – a multiplication factor to be applied tosource_attribute
constant (
float
) – a constant factor to be added tosource_attribute
strength (
int
) – the strength of the constraint
- Returns:
the newly created constraint
- Return type:
Creates a new constraint representing a relation between a layout attribute on a source and a layout attribute on a target.
- classmethod new_constant(target, target_attribute, relation, constant, strength)[source]¶
- Parameters:
target (
Gtk.ConstraintTarget
orNone
) – a the target of the constrainttarget_attribute (
Gtk.ConstraintAttribute
) – the attribute oftarget
to be setrelation (
Gtk.ConstraintRelation
) – the relation equivalence betweentarget_attribute
andconstant
constant (
float
) – a constant factor to be set ontarget_attribute
strength (
int
) – the strength of the constraint
- Returns:
the newly created constraint
- Return type:
Creates a new constraint representing a relation between a layout attribute on a target and a constant value.
- get_constant()[source]¶
- Returns:
a constant factor
- Return type:
Retrieves the constant factor added to the source attributes’ value.
- get_multiplier()[source]¶
- Returns:
a multiplication factor
- Return type:
Retrieves the multiplication factor applied to the source attribute’s value.
- get_relation()[source]¶
- Returns:
a relation type
- Return type:
The order relation between the terms of the constraint.
- get_source()[source]¶
- Returns:
the source of the constraint
- Return type:
Retrieves the [iface`Gtk`.ConstraintTarget] used as the source for the constraint.
If the source is set to
NULL
at creation, the constraint will use the widget using the [class`Gtk`.ConstraintLayout] as the source.
- get_source_attribute()[source]¶
- Returns:
the source’s attribute
- Return type:
Retrieves the attribute of the source to be read by the constraint.
- get_strength()[source]¶
- Returns:
the strength value
- Return type:
Retrieves the strength of the constraint.
- get_target()[source]¶
- Returns:
a
GtkConstraintTarget
- Return type:
Retrieves the [iface`Gtk`.ConstraintTarget] used as the target for the constraint.
If the targe is set to
NULL
at creation, the constraint will use the widget using the [class`Gtk`.ConstraintLayout] as the target.
- get_target_attribute()[source]¶
- Returns:
the target’s attribute
- Return type:
Retrieves the attribute of the target to be set by the constraint.
- is_attached()[source]¶
- Returns:
TRUE
if the constraint is attached- Return type:
Checks whether the constraint is attached to a [class`Gtk`.ConstraintLayout], and it is contributing to the layout.
Property Details¶
- Gtk.Constraint.props.constant¶
- Name:
constant
- Type:
- Default Value:
0.0
- Flags:
The constant value to be added to the [property`Gtk`.Constraint:source-attribute].
- Gtk.Constraint.props.multiplier¶
- Name:
multiplier
- Type:
- Default Value:
1.0
- Flags:
The multiplication factor to be applied to the [property`Gtk`.Constraint:source-attribute].
- Gtk.Constraint.props.relation¶
- Name:
relation
- Type:
- Default Value:
- Flags:
The order relation between the terms of the constraint.
- Gtk.Constraint.props.source¶
- Name:
source
- Type:
- Default Value:
- Flags:
The source of the constraint.
The constraint will set the [property`Gtk`.Constraint:target-attribute] property of the target using the [property`Gtk`.Constraint:source-attribute] property of the source.
- Gtk.Constraint.props.source_attribute¶
- Name:
source-attribute
- Type:
- Default Value:
- Flags:
The attribute of the [property`Gtk`.Constraint:source] read by the constraint.
- Gtk.Constraint.props.strength¶
- Name:
strength
- Type:
- Default Value:
1001001000
- Flags:
The strength of the constraint.
The strength can be expressed either using one of the symbolic values of the [enum`Gtk`.ConstraintStrength] enumeration, or any positive integer value.
- Gtk.Constraint.props.target¶
- Name:
target
- Type:
- Default Value:
- Flags:
The target of the constraint.
The constraint will set the [property`Gtk`.Constraint:target-attribute] property of the target using the [property`Gtk`.Constraint:source-attribute] property of the source widget.
- Gtk.Constraint.props.target_attribute¶
- Name:
target-attribute
- Type:
- Default Value:
- Flags:
The attribute of the [property`Gtk`.Constraint:target] set by the constraint.