Squeezer#
Deprecated since version 1.4: See the migration guide
Superclasses: Widget
, InitiallyUnowned
, Object
Implemented Interfaces: Accessible
, Buildable
, ConstraintTarget
, Orientable
A best fit container.

The AdwSqueezer
widget is a container which only shows the first of its
children that fits in the available size. It is convenient to offer different
widgets to represent the same data with different levels of detail, making
the widget seem to squeeze itself to fit in the available space.
Transitions between children can be animated as fades. This can be controlled
with transition_type
.
CSS nodes#
AdwSqueezer
has a single CSS node with name squeezer
.
Constructors#
- class Squeezer
- classmethod new() Widget #
Creates a new
AdwSqueezer
.Deprecated since version 1.4: See the migration guide
Methods#
- class Squeezer
- add(child: Widget) SqueezerPage #
Adds a child to
self
.Deprecated since version 1.4: See the migration guide
- Parameters:
child – the widget to add
- get_allow_none() bool #
Gets whether to allow squeezing beyond the last child’s minimum size.
Deprecated since version 1.4: See the migration guide
- get_homogeneous() bool #
Gets whether all children have the same size for the opposite orientation.
Deprecated since version 1.4: See the migration guide
- get_interpolate_size() bool #
Gets whether
self
interpolates its size when changing the visible child.Deprecated since version 1.4: See the migration guide
- get_page(child: Widget) SqueezerPage #
Returns the
SqueezerPage
object forchild
.Deprecated since version 1.4: See the migration guide
- Parameters:
child – a child of
self
- get_pages() SelectionModel #
Returns a
ListModel
that contains the pages ofself
.This can be used to keep an up-to-date view. The model also implements
SelectionModel
and can be used to track the visible page.Deprecated since version 1.4: See the migration guide
- get_switch_threshold_policy() FoldThresholdPolicy #
Gets the switch threshold policy for
self
.Deprecated since version 1.4: See the migration guide
- get_transition_duration() int #
Gets the transition animation duration for
self
.Deprecated since version 1.4: See the migration guide
- get_transition_running() bool #
Gets whether a transition is currently running for
self
.If a transition is impossible, the property value will be set to
TRUE
and then immediately toFALSE
, so it’s possible to rely on its notifications to know that a transition has happened.Deprecated since version 1.4: See the migration guide
- get_transition_type() SqueezerTransitionType #
Gets the type of animation used for transitions between children in
self
.Deprecated since version 1.4: See the migration guide
- get_visible_child() Widget | None #
Gets the currently visible child of
self
.Deprecated since version 1.4: See the migration guide
- get_xalign() float #
Gets the horizontal alignment, from 0 (start) to 1 (end).
Deprecated since version 1.4: See the migration guide
- get_yalign() float #
Gets the vertical alignment, from 0 (top) to 1 (bottom).
Deprecated since version 1.4: See the migration guide
- remove(child: Widget) None #
Removes a child widget from
self
.Deprecated since version 1.4: See the migration guide
- Parameters:
child – the child to remove
- set_allow_none(allow_none: bool) None #
Sets whether to allow squeezing beyond the last child’s minimum size.
If set to
TRUE
, the squeezer can shrink to the point where no child can be shown. This is functionally equivalent to appending a widget with 0×0 minimum size.Deprecated since version 1.4: See the migration guide
- Parameters:
allow_none – whether
self
allows squeezing beyond the last child
- set_homogeneous(homogeneous: bool) None #
Sets whether all children have the same size for the opposite orientation.
For example, if a squeezer is horizontal and is homogeneous, it will request the same height for all its children. If it isn’t, the squeezer may change size when a different child becomes visible.
Deprecated since version 1.4: See the migration guide
- Parameters:
homogeneous – whether
self
is homogeneous
- set_interpolate_size(interpolate_size: bool) None #
Sets whether
self
interpolates its size when changing the visible child.If
TRUE
, the squeezer will interpolate its size between the one of the previous visible child and the one of the new visible child, according to the set transition duration and the orientation, e.g. if the squeezer is horizontal, it will interpolate the its height.Deprecated since version 1.4: See the migration guide
- Parameters:
interpolate_size – whether to interpolate the size
- set_switch_threshold_policy(policy: FoldThresholdPolicy) None #
Sets the switch threshold policy for
self
.Determines when the squeezer will switch children.
If set to
ADW_FOLD_THRESHOLD_POLICY_MINIMUM
, it will only switch when the visible child cannot fit anymore. WithADW_FOLD_THRESHOLD_POLICY_NATURAL
, it will switch as soon as the visible child doesn’t get their natural size.This can be useful if you have a long ellipsizing label and want to let it ellipsize instead of immediately switching.
Deprecated since version 1.4: See the migration guide
- Parameters:
policy – the policy to use
- set_transition_duration(duration: int) None #
Sets the transition animation duration for
self
.Deprecated since version 1.4: See the migration guide
- Parameters:
duration – the new duration, in milliseconds
- set_transition_type(transition: SqueezerTransitionType) None #
Sets the type of animation used for transitions between children in
self
.Deprecated since version 1.4: See the migration guide
- Parameters:
transition – the new transition type
- set_xalign(xalign: float) None #
Sets the horizontal alignment, from 0 (start) to 1 (end).
This affects the children allocation during transitions, when they exceed the size of the squeezer.
For example, 0.5 means the child will be centered, 0 means it will keep the start side aligned and overflow the end side, and 1 means the opposite.
Deprecated since version 1.4: See the migration guide
- Parameters:
xalign – the new alignment value
- set_yalign(yalign: float) None #
Sets the vertical alignment, from 0 (top) to 1 (bottom).
This affects the children allocation during transitions, when they exceed the size of the squeezer.
For example, 0.5 means the child will be centered, 0 means it will keep the top side aligned and overflow the bottom side, and 1 means the opposite.
Deprecated since version 1.4: See the migration guide
- Parameters:
yalign – the new alignment value
Properties#
- class Squeezer
- props.allow_none: bool#
The type of the None singleton.
Deprecated since version 1.4: See the migration guide
- props.homogeneous: bool#
The type of the None singleton.
Deprecated since version 1.4: See the migration guide
- props.interpolate_size: bool#
The type of the None singleton.
Deprecated since version 1.4: See the migration guide
- props.pages: SelectionModel#
The type of the None singleton.
Deprecated since version 1.4: See the migration guide
- props.switch_threshold_policy: FoldThresholdPolicy#
The type of the None singleton.
Deprecated since version 1.4: See the migration guide
- props.transition_duration: int#
The type of the None singleton.
Deprecated since version 1.4: See the migration guide
- props.transition_running: bool#
The type of the None singleton.
Deprecated since version 1.4: See the migration guide
- props.transition_type: SqueezerTransitionType#
The type of the None singleton.
Deprecated since version 1.4: See the migration guide
- props.visible_child: Widget#
The type of the None singleton.
Deprecated since version 1.4: See the migration guide
- props.xalign: float#
The type of the None singleton.
Deprecated since version 1.4: See the migration guide
- props.yalign: float#
The type of the None singleton.
Deprecated since version 1.4: See the migration guide