:right-sidebar: True SwitchRow =================================================================== .. currentmodule:: gi.repository.Adw .. versionadded:: 1.4 .. class:: SwitchRow(**properties: ~typing.Any) :no-contents-entry: Superclasses: :class:`~gi.repository.Adw.ActionRow`, :class:`~gi.repository.Adw.PreferencesRow`, :class:`~gi.repository.Gtk.ListBoxRow`, :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.Actionable`, :class:`~gi.repository.Gtk.Buildable`, :class:`~gi.repository.Gtk.ConstraintTarget` A :obj:`~gi.repository.Gtk.ListBoxRow` used to represent two states. .. image:: https://gnome.pages.gitlab.gnome.org/libadwaita/doc/1-latest/switch-row.png The ``AdwSwitchRow`` widget contains a :obj:`~gi.repository.Gtk.Switch` that allows the user to select between two states: "on" or "off". When activated, the row will invert its active state. The user can control the switch by activating the row or by dragging on the switch handle. See :obj:`~gi.repository.Gtk.Switch` for details. Example of an ``AdwSwitchRow`` UI definition: .. code-block:: xml :dedent: Switch Row The :obj:`~gi.repository.Adw.SwitchRow.props.active` property should be connected to in order to monitor changes to the active state. Accessibility -------------------------------------------------------------------------------- ``AdwSwitchRow`` uses the ``GTK_ACCESSIBLE_ROLE_SWITCH`` role. Constructors ------------ .. rst-class:: interim-class .. class:: SwitchRow :no-index: .. classmethod:: new() -> ~gi.repository.Gtk.Widget Creates a new ``AdwSwitchRow``\. .. versionadded:: 1.4 Methods ------- .. rst-class:: interim-class .. class:: SwitchRow :no-index: .. method:: get_active() -> bool Gets whether ``self`` is in its "on" or "off" position. .. versionadded:: 1.4 .. method:: set_active(is_active: bool) -> None Sets whether ``self`` is in its "on" or "off" position .. versionadded:: 1.4 :param is_active: whether ``self`` should be active Properties ---------- .. rst-class:: interim-class .. class:: SwitchRow :no-index: .. attribute:: props.active :type: bool The type of the None singleton. .. versionadded:: 1.4