gtk.CheckMenuItem

gtk.CheckMenuItem — a menu item with a check box.

Synopsis

class gtk.CheckMenuItem(gtk.MenuItem):
    gtk.CheckMenuItem(label=None, use_underline=TRUE)
def set_active(is_active)
def get_active()
def toggled()
def set_inconsistent(setting)
def get_inconsistent()
def set_draw_as_radio(draw_as_radio)
def get_draw_as_radio()

Ancestry

+-- gobject.GObject
  +-- gtk.Object
    +-- gtk.Widget
      +-- gtk.Container
        +-- gtk.Bin
          +-- gtk.Item
            +-- gtk.MenuItem
              +-- gtk.CheckMenuItem

gtk.CheckMenuItem Properties

gtk.Object Properties

gtk.Widget Properties

gtk.Container Properties

"active"Read/WriteIf TRUE, the menu item is checked.
"inconsistent"Read/WriteIf TRUE, display an "inconsistent" state.
"draw-as-radio"Read/WriteIf TRUE, display like a radio menu item. GTK+ 2.4 and above.

gtk.CheckMenuItem Style Properties

gtk.Widget Style Properties

gtk.MenuItem Style Properties

"indicator-size"ReadThe size of the check or radio indicator.

Attributes

"active"ReadIf TRUE, the menu item is checked.

gtk.CheckMenuItem Signal Prototypes

gobject.GObject Signal Prototypes

gtk.Object Signal Prototypes

gtk.Widget Signal Prototypes

gtk.Container Signal Prototypes

gtk.Item Signal Prototypes

gtk.MenuItem Signal Prototypes

"toggled" def callback(checkmenuitem, user_param1, ...)

Description

A gtk.CheckMenuItem is a menu item that maintains the state of a boolean value in addition to a gtk.MenuItem's 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.

Constructor

    gtk.CheckMenuItem(label=None, use_underline=TRUE)
label :a string to be used as the label text or None
use_underline :if TRUE, an underscore in the label text indicates the next character should be underlined and used for the mnemonic accelerator key if it is the first character so marked. Available in PyGTK 2.4 and above.
Returns :a new checkmenuitem

Creates a new checkmenuitem with a text label specified by label. If label is None or not specified then no label is created. If label contains underscore characters then the character following the underscore will be underlined and the character following the first underscore will be used as the mnemonic keyboard accelerator.

In PyGTK 2.4 and above the use_underline parameter is available and defaults to TRUE. If use_underline is set to FALSE the label text will not be parsed for mnemonic characters.

Methods

gtk.CheckMenuItem.set_active

    def set_active(is_active)
is_active :If TRUE set the check box active

The set_active() method sets the active state of the menu item's check box according to the value of is_active.

gtk.CheckMenuItem.get_active

    def get_active()
Returns :TRUE if the menu item is checked (check box is active).

The get_active() method returns whether the check menu item is active. See gtk.CheckMenuItem.set_active().

gtk.CheckMenuItem.toggled

    def toggled()

The toggle() method emits the "toggled" signal on the checkmenuitem

gtk.CheckMenuItem.set_inconsistent

    def set_inconsistent(setting)
setting :If TRUE display an "inconsistent" third state check

The set_inconsistent() method sets the check box to display an "inconsistent" state if the value of setting is TRUE. The "inconsistent" state display is removed if setting is FALSE.

An application may want to display an "inconsistent" state 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 for those elements cannot be represented by a single checkmenuitem state. The set_inconsistent() method only affects visual appearance, it doesn't affect the semantics of the widget.

gtk.CheckMenuItem.get_inconsistent

    def get_inconsistent()
Returns :TRUE if the checkmenuitem displays the "inconsistent" state

The get_inconsistent() method retrieves the value set by the set_inconsistent() method.

gtk.CheckMenuItem.set_draw_as_radio

    def set_draw_as_radio(draw_as_radio)
draw_as_radio :If TRUE display the check menu item like a radio menu item

Note

This method is available in PyGTK 2.4 and above.

The set_draw_as_radio() method displays the check menu item like a radio menu item if the value of draw_as_radio is TRUE. If draw_as_radio is FALSE the check menu item is displayed as normal.

gtk.CheckMenuItem.get_draw_as_radio

    def get_draw_as_radio()
Returns :TRUE if the checkmenuitem should be displayed like a radio menu item.

Note

This method is available in PyGTK 2.4 and above.

The get_draw_as_radio() method retrieves the value set by the set_draw_as_radio() method.

Signals

The "toggled" gtk.CheckMenuItem Signal

    def callback(checkmenuitem, user_param1, ...)
checkmenuitem :the checkmenuitem that received the signal
user_param1 :the first user parameter (if any) specified with the connect() method
... :additional user parameters (if any)

The "toggled" signal is emitted when the checkmenuitem changes state.