Gtk.CheckMenuItem¶
- Subclasses:
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 |
|
class |
|
class |
|
|
|
|
|
|
|
|
|
|
Virtual Methods¶
- Inherited:
Gtk.MenuItem (8), Gtk.Container (10), Gtk.Widget (82), GObject.Object (7), Gtk.Buildable (10), Gtk.Actionable (4), Gtk.Activatable (2)
|
|
|
Properties¶
- Inherited:
Gtk.MenuItem (5), Gtk.Container (3), Gtk.Widget (39), Gtk.Actionable (2), Gtk.Activatable (2)
Name |
Type |
Flags |
Short Description |
---|---|---|---|
r/w/en |
Whether the menu item is checked |
||
r/w/en |
Whether the menu item looks like a radio menu item |
||
r/w/en |
Whether to display an “inconsistent” state |
Style Properties¶
- Inherited:
Name |
Type |
Default |
Flags |
Short Description |
---|---|---|---|---|
|
|
d/r |
Size of check or radio indicator |
Signals¶
- Inherited:
Gtk.MenuItem (6), Gtk.Container (4), Gtk.Widget (69), GObject.Object (1)
Name |
Short Description |
---|---|
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 |
r |
Class Details¶
- class Gtk.CheckMenuItem(*args, **kwargs)¶
- Bases:
- Abstract:
No
- Structure:
A
Gtk.CheckMenuItem
is a menu item that maintains the state of a boolean value in addition to aGtk.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 theGtk.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:
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:
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:
Creates a new
Gtk.CheckMenuItem
containing a label. The label will be created usingGtk.Label.new_with_mnemonic
(), so underscores in label indicate the mnemonic for the menu item.
- get_active()[source]¶
-
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:
Returns whether self looks like a
Gtk.RadioMenuItem
New in version 2.4.
- get_inconsistent()[source]¶
-
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 aGtk.RadioMenuItem
Sets whether self is drawn like a
Gtk.RadioMenuItem
New in version 2.4.
- set_inconsistent(setting)[source]¶
-
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
) –
Called to draw the check indicator.
- do_toggled() virtual¶
Emits the
Gtk.CheckMenuItem
::toggled
signal.
Signal Details¶
- Gtk.CheckMenuItem.signals.toggled(check_menu_item)¶
- Signal Name:
toggled
- Flags:
- 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:
- Default Value:
- Flags:
Whether the menu item is checked
- Gtk.CheckMenuItem.props.draw_as_radio¶
- Name:
draw-as-radio
- Type:
- Default Value:
- Flags:
Whether the menu item looks like a radio menu item