:right-sidebar: True AspectFrame =================================================================== .. currentmodule:: gi.repository.Gtk .. class:: AspectFrame(**properties: ~typing.Any) :no-contents-entry: Superclasses: :class:`~gi.repository.Gtk.Widget`, :class:`~gi.repository.GObject.InitiallyUnowned`, :class:`~gi.repository.GObject.Object` Implemented Interfaces: :class:`~gi.repository.Gtk.Accessible`, :class:`~gi.repository.Gtk.Buildable`, :class:`~gi.repository.Gtk.ConstraintTarget` :Constructors: :: AspectFrame(**properties) new(xalign:float, yalign:float, ratio:float, obey_child:bool) -> Gtk.Widget Constructors ------------ .. rst-class:: interim-class .. class:: AspectFrame :no-index: .. classmethod:: new(xalign: float, yalign: float, ratio: float, obey_child: bool) -> ~gi.repository.Gtk.Widget Create a new ``GtkAspectFrame``. :param xalign: Horizontal alignment of the child within the parent. Ranges from 0.0 (left aligned) to 1.0 (right aligned) :param yalign: Vertical alignment of the child within the parent. Ranges from 0.0 (top aligned) to 1.0 (bottom aligned) :param ratio: The desired aspect ratio. :param obey_child: If :const:`True`, ``ratio`` is ignored, and the aspect ratio is taken from the requistion of the child. Methods ------- .. rst-class:: interim-class .. class:: AspectFrame :no-index: .. method:: get_child() -> ~gi.repository.Gtk.Widget | None Gets the child widget of ``self``. .. method:: get_obey_child() -> bool Returns whether the child's size request should override the set aspect ratio of the ``GtkAspectFrame``. .. method:: get_ratio() -> float Returns the desired aspect ratio of the child. .. method:: get_xalign() -> float Returns the horizontal alignment of the child within the allocation of the ``GtkAspectFrame``. .. method:: get_yalign() -> float Returns the vertical alignment of the child within the allocation of the ``GtkAspectFrame``. .. method:: set_child(child: ~gi.repository.Gtk.Widget | None = None) -> None Sets the child widget of ``self``. :param child: the child widget .. method:: set_obey_child(obey_child: bool) -> None Sets whether the aspect ratio of the child's size request should override the set aspect ratio of the ``GtkAspectFrame``. :param obey_child: If :const:`True`, ``ratio`` is ignored, and the aspect ratio is taken from the requisition of the child. .. method:: set_ratio(ratio: float) -> None Sets the desired aspect ratio of the child. :param ratio: aspect ratio of the child .. method:: set_xalign(xalign: float) -> None Sets the horizontal alignment of the child within the allocation of the ``GtkAspectFrame``. :param xalign: horizontal alignment, from 0.0 (left aligned) to 1.0 (right aligned) .. method:: set_yalign(yalign: float) -> None Sets the vertical alignment of the child within the allocation of the ``GtkAspectFrame``. :param yalign: horizontal alignment, from 0.0 (top aligned) to 1.0 (bottom aligned) Properties ---------- .. rst-class:: interim-class .. class:: AspectFrame :no-index: .. attribute:: props.child :type: ~gi.repository.Gtk.Widget The child widget. .. attribute:: props.obey_child :type: bool Whether the ``GtkAspectFrame`` should use the aspect ratio of its child. .. attribute:: props.ratio :type: float The aspect ratio to be used by the ``GtkAspectFrame``. This property is only used if :obj:`~gi.repository.Gtk.AspectFrame.props.obey_child` is set to :const:`False`. .. attribute:: props.xalign :type: float The horizontal alignment of the child. .. attribute:: props.yalign :type: float The vertical alignment of the child.