Toggle#

Added in version 1.7.

class Toggle(**properties: Any)#

Superclasses: Object

A toggle within ToggleGroup.

AdwToggle can optionally have a name, set with name. If the name is set, active_name can be used to access toggles instead of index.

Constructors#

class Toggle
classmethod new() Toggle#

Creates a new AdwToggle.

Added in version 1.7.

Methods#

class Toggle
get_child() Widget | None#

Gets the child widget of self.

Added in version 1.7.

get_description() str#

Gets the description of self.

Added in version 1.9.

get_enabled() bool#

Gets whether self is enabled.

Added in version 1.7.

get_icon_name() str | None#

Gets the icon name of self.

Added in version 1.7.

get_index() int#

Gets the index of self within its toggle group.

Added in version 1.7.

get_label() str | None#

Gets the label of self.

Added in version 1.7.

get_name() str#

Gets the name of self.

Added in version 1.7.

get_tooltip() str#

Gets the tooltip of self.

Added in version 1.7.

get_use_underline() bool#

Gets whether self uses underlines.

Added in version 1.7.

set_child(child: Widget | None = None) None#

Sets the child of self to child.

When the child is set, icon and label are not displayed.

It’s recommended to still set the label, as it can still be used by the screen reader.

Added in version 1.7.

Parameters:

child – a child widget

set_description(description: str) None#

Sets the description of self to description.

The description will be read out when using screen reader. If not set, tooltip will be used instead.

See description.

Added in version 1.9.

Parameters:

description – the description

set_enabled(enabled: bool) None#

Sets whether self is enabled.

Added in version 1.7.

Parameters:

enabled – whether the toggle should be enbled

set_icon_name(icon_name: str | None = None) None#

Sets the icon name of self to icon_name.

The icon will be displayed alone or next to the label, unless child is set.

Added in version 1.7.

Parameters:

icon_name – the icon name

set_label(label: str | None = None) None#

Sets the label of self to label.

The label will be displayed alone or next to the icon, unless child is set, but will still be read out by the screen reader.

Added in version 1.7.

Parameters:

label – a label

set_name(name: str | None = None) None#

Sets the name of self to name.

Allows accessing self by its name instead of index.

See active_name.

Added in version 1.7.

Parameters:

name – a name

set_tooltip(tooltip: str) None#

Sets the tooltip of self to tooltip.

tooltip can be marked up with the Pango text markup language.

Tooltip text will also be used as accessible description. Use description to set it separately.

Added in version 1.7.

Parameters:

tooltip – the tooltip

set_use_underline(use_underline: bool) None#

Sets whether an embedded underline in the label indicates a mnemonic.

See label.

Added in version 1.7.

Parameters:

use_underline – whether an underline in the label indicates a mnemonic

Properties#

class Toggle
props.child: Widget#

The type of the None singleton.

Added in version 1.7.

props.description: str#

The type of the None singleton.

Added in version 1.9.

props.enabled: bool#

The type of the None singleton.

Added in version 1.7.

props.icon_name: str#

The type of the None singleton.

Added in version 1.7.

props.label: str#

The type of the None singleton.

Added in version 1.7.

props.name: str#

The type of the None singleton.

Added in version 1.7.

props.tooltip: str#

The type of the None singleton.

Added in version 1.7.

props.use_underline: bool#

The type of the None singleton.

Added in version 1.7.