Adw.Toggle

g Adw.Toggle Adw.Toggle GObject.Object GObject.Object GObject.Object->Adw.Toggle

Subclasses:

None

Methods

Inherited:

GObject.Object (37)

Structs:

GObject.ObjectClass (5)

class

new ()

get_child ()

get_enabled ()

get_icon_name ()

get_index ()

get_label ()

get_name ()

get_tooltip ()

get_use_underline ()

set_child (child)

set_enabled (enabled)

set_icon_name (icon_name)

set_label (label)

set_name (name)

set_tooltip (tooltip)

set_use_underline (use_underline)

Virtual Methods

Inherited:

GObject.Object (7)

Properties

Name

Type

Flags

Short Description

child

Gtk.Widget

r/w/en

enabled

bool

r/w/en

icon-name

str

r/w/en

label

str

r/w/en

name

str

r/w/en

tooltip

str

r/w/en

use-underline

bool

r/w/en

Signals

Inherited:

GObject.Object (1)

Fields

Inherited:

GObject.Object (1)

Class Details

class Adw.Toggle(**kwargs)
Bases:

GObject.Object

Abstract:

No

Structure:

Adw.ToggleClass

A toggle within [class`ToggleGroup`].

AdwToggle can optionally have a name, set with [property`Toggle`:py:data::name<Adw.Toggle.props.name>]. If the name is set, [property`ToggleGroup`:py:data::active-name<Adw.Toggle.props.active_name>] can be used to access toggles instead of index.

New in version 1.7.

classmethod new()
Returns:

the newly created AdwToggle

Return type:

Adw.Toggle

Creates a new AdwToggle.

New in version 1.7.

get_child()
Returns:

the toggle child

Return type:

Gtk.Widget or None

Gets the child widget of self.

New in version 1.7.

get_enabled()
Returns:

whether the toggle is enabled

Return type:

bool

Gets whether self is enabled.

New in version 1.7.

get_icon_name()
Returns:

the toggle icon name

Return type:

str or None

Gets the icon name of self.

New in version 1.7.

get_index()
Returns:

the index, or GTK_INVALID_LIST_POSITION if it’s not in a group

Return type:

int

Gets the index of self within its toggle group.

New in version 1.7.

get_label()
Returns:

the toggle label

Return type:

str or None

Gets the label of self.

New in version 1.7.

get_name()
Returns:

the toggle name

Return type:

str

Gets the name of self.

New in version 1.7.

get_tooltip()
Returns:

the toggle tooltip

Return type:

str

Gets the tooltip of self.

New in version 1.7.

get_use_underline()
Returns:

whether the toggle uses underlines

Return type:

bool

Gets whether self uses underlines.

New in version 1.7.

set_child(child)
Parameters:

child (Gtk.Widget or None) – a child widget

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.

New in version 1.7.

set_enabled(enabled)
Parameters:

enabled (bool) – whether the toggle should be enbled

Sets whether self is enabled.

New in version 1.7.

set_icon_name(icon_name)
Parameters:

icon_name (str or None) – the icon name

Sets the icon name of self to icon_name.

The icon will be displayed alone or next to the label, unless [property`Toggle`:py:data::child<Adw.Toggle.props.child>] is set.

New in version 1.7.

set_label(label)
Parameters:

label (str or None) – a label

Sets the label of self to label.

The label will be displayed alone or next to the icon, unless [property`Toggle`:py:data::child<Adw.Toggle.props.child>] is set, but will still be read out by the screen reader.

New in version 1.7.

set_name(name)
Parameters:

name (str or None) – a name

Sets the name of self to name.

Allows accessing self by its name instead of index.

See [property`ToggleGroup`:py:data::active-name<Adw.Toggle.props.active_name>].

New in version 1.7.

set_tooltip(tooltip)
Parameters:

tooltip (str) – the tooltip

Sets the tooltip of self to tooltip.

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

New in version 1.7.

set_use_underline(use_underline)
Parameters:

use_underline (bool) – whether an underline in the label indicates a mnemonic

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

See [property`Toggle`:py:data::label<Adw.Toggle.props.label>].

New in version 1.7.

Property Details

Adw.Toggle.props.child
Name:

child

Type:

Gtk.Widget

Default Value:

None

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

The toggle 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.

New in version 1.7.

Adw.Toggle.props.enabled
Name:

enabled

Type:

bool

Default Value:

True

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

Whether this toggle is enabled.

New in version 1.7.

Adw.Toggle.props.icon_name
Name:

icon-name

Type:

str

Default Value:

None

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

The toggle icon name.

The icon will be displayed alone or next to the label, unless [property`Toggle`:py:data::child<Adw.Toggle.props.child>] is set.

New in version 1.7.

Adw.Toggle.props.label
Name:

label

Type:

str

Default Value:

None

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

The toggle label.

The label will be displayed alone or next to the icon, unless [property`Toggle`:py:data::child<Adw.Toggle.props.child>] is set, but will still be read out by the screen reader.

New in version 1.7.

Adw.Toggle.props.name
Name:

name

Type:

str

Default Value:

None

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

The toggle name.

Allows accessing the toggle by its name instead of index.

See [property`ToggleGroup`:py:data::active-name<Adw.Toggle.props.active_name>].

New in version 1.7.

Adw.Toggle.props.tooltip
Name:

tooltip

Type:

str

Default Value:

''

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

The tooltip of the toggle.

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

New in version 1.7.

Adw.Toggle.props.use_underline
Name:

use-underline

Type:

bool

Default Value:

False

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

Whether an embedded underline in the label indicates a mnemonic.

See [property`Toggle`:py:data::label<Adw.Toggle.props.label>].

New in version 1.7.