gtk.ImageMenuItem

gtk.ImageMenuItem — a menuitem that displays an image with an accel label

Synopsis

class gtk.ImageMenuItem(gtk.MenuItem):
    gtk.ImageMenuItem(stock_id=None, accel_group=None)
def set_image(image)
def get_image()
def set_always_show_image(always_show)
def get_always_show_image()
def set_use_stock(use_stock)
def get_use_stock()
def set_accel_group(accel_group)

Ancestry

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

Implemented Interfaces

gtk.ImageMenuItem implements gtk.Buildable

gtk.ImageMenuItem Properties

gtk.Object Properties

gtk.Widget Properties

gtk.Container Properties

"accel-group"WriteThe Accel Group to use for stock accelerator keys. Available in GTK+ 2.16 and above.
"always-show-image"Read-Write-ConstructIf True, the menu item will ignore the "gtk-menu-images" setting and always show the image, if available. Use this property if the menuitem would be useless or hard to use without the image. Default value: False. Available in GTK+ 2.16 and above.
"image"Read-Writethe child widget that is next to the text in the menu item
"use-stock"Read-Write-ConstructIf True, the label set in the menuitem is used as a stock id to select the stock item for the item. Default value: False. Available in GTK+ 2.16 and above.

gtk.ImageMenuItem Style Properties

gtk.Widget Style Properties

gtk.MenuItem Style Properties

gtk.ImageMenuItem 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

Description

The gtk.ImageMenuItem widget is a subclass of gtk.MenuItem that contains an image widget and a gtk.AccelLabel though a gtk.ImageMenuItem can be created that has no image and an empty label.

Constructor

    gtk.ImageMenuItem(stock_id=None, accel_group=None)

stock_id :

the stock icon ID or None if no image is needed

accel_group :

the accel group to add the accel label mnemonic to

Returns :

a new gtk.ImageMenuItem widget

Creates a new gtk.ImageMenuItem with a stock label and image specified by stock_id. If stock_id is not a stock item then the image will be the "broken image" and the label text will be the string in stock_id. The label text will be parsed for underscore characters to indicate the mnemonic character for the accelerator.

If stock_id specifies a stock item and accel_group specifies a gtk.AccelGroup the accelerator is added to accel_group.

Methods

gtk.ImageMenuItem.set_image

    def set_image(image)

image :

a widget to set as the image for the menu item.

The set_image() method sets the image of the image menu item to the widget specified in image.

gtk.ImageMenuItem.get_image

    def get_image()

Returns :

the image in the image menu item

The get_image() method gets the widget that is currently set as the image of image menu item. See set_image().

gtk.ImageMenuItem.set_always_show_image

    def set_always_show_image(always_show)

always_show :

True if the menuitem should always show the image, False otherwise.

Note

This method is available in PyGTK 2.16 and above.

The set_always_show_image() method sets whether the menu item will ignore the "gtk-menu-images" setting and always show the image, if available.

gtk.ImageMenuItem.get_always_show_image

    def get_always_show_image()

Returns :

True if the menuitem will always show the image, False otherwise..

Note

This method is available in PyGTK 2.16 and above.

The get_always_show_image() method returns whether the menu item will ignore the "gtk-menu-images" setting and always show the image, if available.

gtk.ImageMenuItem.set_use_stock

    def set_use_stock(use_stock)

use_stock :

True if the menuitem should use a stock item, False otherwise.

Note

This method is available in PyGTK 2.16 and above.

The set_use_stock() method sets whether the label set in the menuitem is used as a stock id to select the stock item for the item.

gtk.ImageMenuItem.get_use_stock

    def get_use_stock()

Returns :

True if the menuitem will use a stock item, False otherwise.

Note

This method is available in PyGTK 2.16 and above.

The get_use_stock() method gets whether the label set in the menuitem is used as a stock id to select the stock item for the item.

gtk.ImageMenuItem.set_accel_group

    def set_accel_group(accel_group)

accel_group :

The gtk.AccelGroup.

Note

This method is available in PyGTK 2.16 and above.

The set_accel_group() method specifies an accel_group to add the menu items accelerator to (this only applies to stock items so a stock item must already be set, make sure to call get_accel_width gtk_image_menu_item_set_use_stock() and gtk_menu_item_set_label() with a valid stock item first).

If you want this menu item to have changeable accelerators then you shouldnt need this (see gtk_image_menu_item_new_from_stock()).