SwitchRow#

Added in version 1.4.

class SwitchRow(**properties: Any)#

Superclasses: ActionRow, PreferencesRow, ListBoxRow, Widget, InitiallyUnowned, Object

Implemented Interfaces: Accessible, Actionable, Buildable, ConstraintTarget

A ListBoxRow used to represent two states.

https://gnome.pages.gitlab.gnome.org/libadwaita/doc/1-latest/switch-row.png

The AdwSwitchRow widget contains a 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 Switch for details.

Example of an AdwSwitchRow UI definition:

<object class="AdwSwitchRow">
  <property name="title" translatable="yes">Switch Row</property>
  <signal name="notify::active" handler="switch_row_notify_active_cb"/>
</object>

The 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#

class SwitchRow
classmethod new() Widget#

Creates a new AdwSwitchRow.

Added in version 1.4.

Methods#

class SwitchRow
get_active() bool#

Gets whether self is in its “on” or “off” position.

Added in version 1.4.

set_active(is_active: bool) None#

Sets whether self is in its “on” or “off” position

Added in version 1.4.

Parameters:

is_active – whether self should be active

Properties#

class SwitchRow
props.active: bool#

The type of the None singleton.

Added in version 1.4.