Gtk.CheckMenuItem

g Atk.ImplementorIface Atk.ImplementorIface Gtk.Widget Gtk.Widget Atk.ImplementorIface->Gtk.Widget GObject.GInterface GObject.GInterface GObject.GInterface->Atk.ImplementorIface Gtk.Actionable Gtk.Actionable GObject.GInterface->Gtk.Actionable Gtk.Activatable Gtk.Activatable GObject.GInterface->Gtk.Activatable Gtk.Buildable Gtk.Buildable GObject.GInterface->Gtk.Buildable GObject.InitiallyUnowned GObject.InitiallyUnowned GObject.InitiallyUnowned->Gtk.Widget GObject.Object GObject.Object GObject.Object->GObject.InitiallyUnowned Gtk.MenuItem Gtk.MenuItem Gtk.Actionable->Gtk.MenuItem Gtk.Activatable->Gtk.MenuItem Gtk.Bin Gtk.Bin Gtk.Bin->Gtk.MenuItem Gtk.Buildable->Gtk.Widget Gtk.CheckMenuItem Gtk.CheckMenuItem Gtk.Container Gtk.Container Gtk.Container->Gtk.Bin Gtk.MenuItem->Gtk.CheckMenuItem Gtk.Widget->Gtk.Container

Subclasses:

Gtk.RadioMenuItem

Methods

Inherited:

Gtk.MenuItem (20), Gtk.Bin (1), Gtk.Container (35), Gtk.Widget (278), GObject.Object (37), Gtk.Buildable (10), Gtk.Actionable (5), Gtk.Activatable (6)

Structs:

Gtk.ContainerClass (5), Gtk.WidgetClass (12), GObject.ObjectClass (5)

class

new ()

class

new_with_label (label)

class

new_with_mnemonic (label)

get_active ()

get_draw_as_radio ()

get_inconsistent ()

set_active (is_active)

set_draw_as_radio (draw_as_radio)

set_inconsistent (setting)

toggled ()

Virtual Methods

Inherited:

Gtk.MenuItem (8), Gtk.Container (10), Gtk.Widget (82), GObject.Object (7), Gtk.Buildable (10), Gtk.Actionable (4), Gtk.Activatable (2)

do_draw_indicator (cr)

do_toggled ()

Properties

Inherited:

Gtk.MenuItem (5), Gtk.Container (3), Gtk.Widget (39), Gtk.Actionable (2), Gtk.Activatable (2)

Name

Type

Flags

Short Description

active

bool

r/w/en

Whether the menu item is checked

draw-as-radio

bool

r/w/en

Whether the menu item looks like a radio menu item

inconsistent

bool

r/w/en

Whether to display an “inconsistent” state

Style Properties

Inherited:

Gtk.MenuItem (6), Gtk.Widget (17)

Name

Type

Default

Flags

Short Description

indicator-size

int

16

d/r

Size of check or radio indicator deprecated

Signals

Inherited:

Gtk.MenuItem (6), Gtk.Container (4), Gtk.Widget (69), GObject.Object (1)

Name

Short Description

toggled

This signal is emitted when the state of the check box is changed.

Fields

Inherited:

Gtk.MenuItem (6), Gtk.Container (4), Gtk.Widget (69), GObject.Object (1)

Name

Type

Access

Description

menu_item

Gtk.MenuItem

r

Class Details

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

Gtk.MenuItem

Abstract:

No

Structure:

Gtk.CheckMenuItemClass

A Gtk.CheckMenuItem is a menu item that maintains the state of a boolean value in addition to a Gtk.MenuItem usual role in activating application code.

A check box indicating the state of the boolean value is displayed at the left side of the Gtk.MenuItem. Activating the Gtk.MenuItem toggles the value.

CSS nodes
menuitem
├── check.left
╰── <child>

Gtk.CheckMenuItem has a main CSS node with name menuitem, and a subnode with name check, which gets the .left or .right style class.

classmethod new()[source]
Returns:

a new Gtk.CheckMenuItem.

Return type:

Gtk.Widget

Creates a new Gtk.CheckMenuItem.

classmethod new_with_label(label)[source]
Parameters:

label (str) – the string to use for the label.

Returns:

a new Gtk.CheckMenuItem.

Return type:

Gtk.Widget

Creates a new Gtk.CheckMenuItem with a label.

classmethod new_with_mnemonic(label)[source]
Parameters:

label (str) – The text of the button, with an underscore in front of the character

Returns:

a new Gtk.CheckMenuItem

Return type:

Gtk.Widget

Creates a new Gtk.CheckMenuItem containing a label. The label will be created using Gtk.Label.new_with_mnemonic(), so underscores in label indicate the mnemonic for the menu item.

get_active()[source]
Returns:

True if the menu item is checked.

Return type:

bool

Returns whether the check menu item is active. See Gtk.CheckMenuItem.set_active ().

get_draw_as_radio()[source]
Returns:

Whether self looks like a Gtk.RadioMenuItem

Return type:

bool

Returns whether self looks like a Gtk.RadioMenuItem

New in version 2.4.

get_inconsistent()[source]
Returns:

True if inconsistent

Return type:

bool

Retrieves the value set by Gtk.CheckMenuItem.set_inconsistent().

set_active(is_active)[source]
Parameters:

is_active (bool) – boolean value indicating whether the check box is active.

Sets the active state of the menu item’s check box.

set_draw_as_radio(draw_as_radio)[source]
Parameters:

draw_as_radio (bool) – whether self is drawn like a Gtk.RadioMenuItem

Sets whether self is drawn like a Gtk.RadioMenuItem

New in version 2.4.

set_inconsistent(setting)[source]
Parameters:

setting (bool) – True to display an “inconsistent” third state check

If the user has selected a range of elements (such as some text or spreadsheet cells) that are affected by a boolean setting, and the current values in that range are inconsistent, you may want to display the check in an “in between” state. This function turns on “in between” display. Normally you would turn off the inconsistent state again if the user explicitly selects a setting. This has to be done manually, Gtk.CheckMenuItem.set_inconsistent() only affects visual appearance, it doesn’t affect the semantics of the widget.

toggled()[source]

Emits the Gtk.CheckMenuItem ::toggled signal.

do_draw_indicator(cr) virtual
Parameters:

cr (cairo.Context) –

do_toggled() virtual

Emits the Gtk.CheckMenuItem ::toggled signal.

Signal Details

Gtk.CheckMenuItem.signals.toggled(check_menu_item)
Signal Name:

toggled

Flags:

RUN_FIRST

Parameters:

check_menu_item (Gtk.CheckMenuItem) – The object which received the signal

This signal is emitted when the state of the check box is changed.

A signal handler can use Gtk.CheckMenuItem.get_active() to discover the new state.

Property Details

Gtk.CheckMenuItem.props.active
Name:

active

Type:

bool

Default Value:

False

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

Whether the menu item is checked

Gtk.CheckMenuItem.props.draw_as_radio
Name:

draw-as-radio

Type:

bool

Default Value:

False

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

Whether the menu item looks like a radio menu item

Gtk.CheckMenuItem.props.inconsistent
Name:

inconsistent

Type:

bool

Default Value:

False

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

Whether to display an “inconsistent” state