Gtk.AspectFrame¶
class — extends Widget, Accessible, Buildable, ConstraintTarget
Preserves the aspect ratio of its child.
The frame can respect the aspect ratio of the child widget, or use its own aspect ratio.
CSS nodes¶
GtkAspectFrame uses a CSS node with name aspectframe.
Accessibility¶
Until GTK 4.10, GtkAspectFrame used the AccessibleRole.group role.
Starting from GTK 4.12, GtkAspectFrame uses the AccessibleRole.generic role.
Constructors¶
new¶
Create a new GtkAspectFrame.
Parameters:
xalign— Horizontal alignment of the child within the parent. Ranges from 0.0 (left aligned) to 1.0 (right aligned)yalign— Vertical alignment of the child within the parent. Ranges from 0.0 (top aligned) to 1.0 (bottom aligned)ratio— The desired aspect ratio.obey_child— IfTrue,ratiois ignored, and the aspect ratio is taken from the requistion of the child.
Methods¶
get_child¶
Gets the child widget of self.
get_obey_child¶
Returns whether the child's size request should override
the set aspect ratio of the GtkAspectFrame.
get_ratio¶
Returns the desired aspect ratio of the child.
get_xalign¶
Returns the horizontal alignment of the child within the
allocation of the GtkAspectFrame.
get_yalign¶
Returns the vertical alignment of the child within the
allocation of the GtkAspectFrame.
set_child¶
Sets the child widget of self.
Parameters:
child— the child widget
set_obey_child¶
Sets whether the aspect ratio of the child's size
request should override the set aspect ratio of
the GtkAspectFrame.
Parameters:
obey_child— IfTrue,ratiois ignored, and the aspect ratio is taken from the requisition of the child.
set_ratio¶
Sets the desired aspect ratio of the child.
Parameters:
ratio— aspect ratio of the child
set_xalign¶
Sets the horizontal alignment of the child within the allocation
of the GtkAspectFrame.
Parameters:
xalign— horizontal alignment, from 0.0 (left aligned) to 1.0 (right aligned)
set_yalign¶
Sets the vertical alignment of the child within the allocation
of the GtkAspectFrame.
Parameters:
yalign— horizontal alignment, from 0.0 (top aligned) to 1.0 (bottom aligned)
Properties¶
child¶
The child widget.
obey_child¶
Whether the GtkAspectFrame should use the aspect ratio of its child.
ratio¶
The aspect ratio to be used by the GtkAspectFrame.
This property is only used if
AspectFrame.obey-child is set to False.
xalign¶
The horizontal alignment of the child.
yalign¶
The vertical alignment of the child.