Gtk.ToggleAction

g GObject.GInterface GObject.GInterface Gtk.Buildable Gtk.Buildable GObject.GInterface->Gtk.Buildable GObject.Object GObject.Object Gtk.Action Gtk.Action GObject.Object->Gtk.Action Gtk.ToggleAction Gtk.ToggleAction Gtk.Action->Gtk.ToggleAction Gtk.Buildable->Gtk.Action

Subclasses:

Gtk.RadioAction

Methods

Inherited:

Gtk.Action (42), GObject.Object (37), Gtk.Buildable (10)

Structs:

GObject.ObjectClass (5)

class

new (name, label, tooltip, stock_id)

get_active ()

get_draw_as_radio ()

set_active (is_active)

set_draw_as_radio (draw_as_radio)

toggled ()

Virtual Methods

Inherited:

Gtk.Action (6), GObject.Object (7), Gtk.Buildable (10)

do_toggled ()

Properties

Inherited:

Gtk.Action (16)

Name

Type

Flags

Short Description

active

bool

r/w

Whether the toggle action should be active deprecated

draw-as-radio

bool

r/w

Whether the proxies for this action look like radio action proxies deprecated

Signals

Inherited:

Gtk.Action (1), GObject.Object (1)

Name

Short Description

toggled

Should be connected if you wish to perform an action whenever the Gtk.ToggleAction state is changed. deprecated

Fields

Inherited:

Gtk.Action (1), GObject.Object (1)

Name

Type

Access

Description

parent

Gtk.Action

r

Class Details

class Gtk.ToggleAction(*args, **kwargs)
Bases:

Gtk.Action

Abstract:

No

Structure:

Gtk.ToggleActionClass

A Gtk.ToggleAction corresponds roughly to a Gtk.CheckMenuItem. It has an “active” state specifying whether the action has been checked or not.

classmethod new(name, label, tooltip, stock_id)[source]
Parameters:
  • name (str) – A unique name for the action

  • label (str or None) – The label displayed in menu items and on buttons, or None

  • tooltip (str or None) – A tooltip for the action, or None

  • stock_id (str or None) – The stock icon to display in widgets representing the action, or None

Returns:

a new Gtk.ToggleAction

Return type:

Gtk.ToggleAction

Creates a new Gtk.ToggleAction object. To add the action to a Gtk.ActionGroup and set the accelerator for the action, call Gtk.ActionGroup.add_action_with_accel().

New in version 2.4.

Deprecated since version 3.10.

get_active()[source]
Returns:

the checked state of the toggle action

Return type:

bool

Returns the checked state of the toggle action.

New in version 2.4.

Deprecated since version 3.10.

get_draw_as_radio()[source]
Returns:

whether the action should have proxies like a radio action.

Return type:

bool

Returns whether the action should have proxies like a radio action.

New in version 2.4.

Deprecated since version 3.10.

set_active(is_active)[source]
Parameters:

is_active (bool) – whether the action should be checked or not

Sets the checked state on the toggle action.

New in version 2.4.

Deprecated since version 3.10.

set_draw_as_radio(draw_as_radio)[source]
Parameters:

draw_as_radio (bool) – whether the action should have proxies like a radio action

Sets whether the action should have proxies like a radio action.

New in version 2.4.

Deprecated since version 3.10.

toggled()[source]

Emits the “toggled” signal on the toggle action.

New in version 2.4.

Deprecated since version 3.10.

do_toggled() virtual

Emits the “toggled” signal on the toggle action.

New in version 2.4.

Deprecated since version 3.10.

Signal Details

Gtk.ToggleAction.signals.toggled(toggle_action)
Signal Name:

toggled

Flags:

RUN_FIRST

Parameters:

toggle_action (Gtk.ToggleAction) – The object which received the signal

Should be connected if you wish to perform an action whenever the Gtk.ToggleAction state is changed.

Deprecated since version 3.10.

Property Details

Gtk.ToggleAction.props.active
Name:

active

Type:

bool

Default Value:

False

Flags:

READABLE, WRITABLE

Whether the toggle action should be active.

New in version 2.10.

Deprecated since version 3.10.

Gtk.ToggleAction.props.draw_as_radio
Name:

draw-as-radio

Type:

bool

Default Value:

False

Flags:

READABLE, WRITABLE

Whether the proxies for this action look like radio action proxies.

This is an appearance property and thus only applies if Gtk.Activatable :use-action-appearance is True.

Deprecated since version 3.10.