Stock Items

Stock Items — prebuilt common menu/toolbar items and corresponding icons

Synopsis

Functions

    def gtk.stock_add(items)
def gtk.stock_lookup(stock_id)
def gtk.stock_list_ids()

Description

Stock items represent commonly-used menu or toolbar items such as "Open" or "Exit". Each stock item is identified by a stock ID; stock IDs are just strings, but macros such as gtk.STOCK_OPEN are provided to avoid typing mistakes in the strings. Applications can register their own stock items in addition to those built-in to PyGTK.

The stock items are:

gtk.STOCK_ABOUT Available in GTK+ 2.6 and above.
gtk.STOCK_ADD
gtk.STOCK_APPLY
gtk.STOCK_BOLD
gtk.STOCK_CANCEL
gtk.STOCK_CDROM
gtk.STOCK_CLEAR
gtk.STOCK_CLOSE
gtk.STOCK_COLOR_PICKER Available in GTK+ 2.2 and above.
gtk.STOCK_CONVERT
gtk.STOCK_CONNECT Available in GTK+ 2.6 and above.
gtk.STOCK_COPY
gtk.STOCK_CUT
gtk.STOCK_DELETE
gtk.STOCK_DIALOG_AUTHENTICATION Available in GTK+ 2.4 and above.
gtk.STOCK_DIALOG_ERROR
gtk.STOCK_DIALOG_INFO
gtk.STOCK_DIALOG_QUESTION
gtk.STOCK_DIALOG_WARNING
gtk.STOCK_DIRECTORY Available in GTK+ 2.6 and above.
gtk.STOCK_DISCONNECT Available in GTK+ 2.6 and above.
gtk.STOCK_DND
gtk.STOCK_DND_MULTIPLE
gtk.STOCK_EDIT Available in GTK+ 2.6 and above.
gtk.STOCK_EXECUTE
gtk.STOCK_FILE Available in GTK+ 2.6 and above.
gtk.STOCK_FIND
gtk.STOCK_FIND_AND_REPLACE
gtk.STOCK_FLOPPY
gtk.STOCK_FULLSCREEN Available in GTK+ 2.8 and above.
gtk.STOCK_GOTO_BOTTOM
gtk.STOCK_GOTO_FIRST
gtk.STOCK_GOTO_LAST
gtk.STOCK_GOTO_TOP
gtk.STOCK_GO_BACK
gtk.STOCK_GO_DOWN
gtk.STOCK_GO_FORWARD
gtk.STOCK_GO_UP
gtk.STOCK_HARDDISK Available in GTK+ 2.4 and above
gtk.STOCK_HELP
gtk.STOCK_HOME
gtk.STOCK_INDENT Available in GTK+ 2.4 and above.
gtk.STOCK_INDEX
gtk.STOCK_INFO Available in GTK+ 2.8 and above.
gtk.STOCK_ITALIC
gtk.STOCK_JUMP_TO RTL version is
gtk.STOCK_JUSTIFY_CENTER
gtk.STOCK_JUSTIFY_FILL
gtk.STOCK_JUSTIFY_LEFT
gtk.STOCK_JUSTIFY_RIGHT
gtk.STOCK_LEAVE_FULLSCREEN Available in GTK+ 2.8 and above.
gtk.STOCK_MEDIA_FORWARD Available in GTK+ 2.6 and above.
gtk.STOCK_MEDIA_NEXT Available in GTK+ 2.6 and above.
gtk.STOCK_MEDIA_PAUSE Available in GTK+ 2.6 and above.
gtk.STOCK_MEDIA_PLAY RTL version is Available in GTK+ 2.6 and above.
gtk.STOCK_MEDIA_PREVIOUS Available in GTK+ 2.6 and above.
gtk.STOCK_MEDIA_RECORD Available in GTK+ 2.6 and above.
gtk.STOCK_MEDIA_REWIND Available in GTK+ 2.6 and above.
gtk.STOCK_MEDIA_STOP Available in GTK+ 2.6 and above.
gtk.STOCK_MISSING_IMAGE
gtk.STOCK_NETWORK Available in GTK+ 2.4 and above.
gtk.STOCK_NEW
gtk.STOCK_NO
gtk.STOCK_OK
gtk.STOCK_OPEN
gtk.STOCK_PASTE
gtk.STOCK_PREFERENCES
gtk.STOCK_PRINT
gtk.STOCK_PRINT_PREVIEW
gtk.STOCK_PROPERTIES
gtk.STOCK_QUIT
gtk.STOCK_REDO RTL version is
gtk.STOCK_REFRESH
gtk.STOCK_REMOVE
gtk.STOCK_REVERT_TO_SAVED RTL version is
gtk.STOCK_SAVE
gtk.STOCK_SAVE_AS
gtk.STOCK_SELECT_COLOR
gtk.STOCK_SELECT_FONT
gtk.STOCK_SORT_ASCENDING
gtk.STOCK_SORT_DESCENDING
gtk.STOCK_SPELL_CHECK
gtk.STOCK_STOP
gtk.STOCK_STRIKETHROUGH
gtk.STOCK_UNDELETE RTL version is
gtk.STOCK_UNDERLINE
gtk.STOCK_UNDO RTL version is
gtk.STOCK_UNINDENT Available in GTK+ 2.4 and above.
gtk.STOCK_YES
gtk.STOCK_ZOOM_100
gtk.STOCK_ZOOM_FIT
gtk.STOCK_ZOOM_IN
gtk.STOCK_ZOOM_OUT

Functions

gtk.stock_add

    def gtk.stock_add(items)
items :a list or tuple containing 5-tuples of stock items

The gtk.stock_add() function registers each of the stock items in the list or tuple specified by items. The stock items are specified by a 5-tuple containing:

  • stock_id - a string identifier
  • label - a string to use for a label
  • modifier - a modifier mask (see the GDK Modifier Constants section for more detail on modifiers)
  • keyval - an integer key value (see gtk.gdk.Keymap) Together with the modifiers specifies an accelerator.
  • translation_domain - a string identifier of a translation domain

If an item already exists with the same stock ID as one of the items, the old item gets replaced.

gtk.stock_lookup

    def gtk.stock_lookup(stock_id)
stock_id :a stock item name
Returns :a 5-tuple containing the stock item info or None if stock_id is unknown

The gtk.stock_lookup() function looks up the stock item identified by stock_id and returns a 5-tuple containing its information. If stock_id is not known this function returns None. See the gtk.stock_add() function for more detail.

gtk.stock_list_ids

    def gtk.stock_list_ids()
Returns :a list of known stock IDs

The gtk.stock_list_ids() function returns a list containing all of the known stock IDs added to a gtk.IconFactory or registered with the gtk.stock_add() function.