gtk.OptionMenu

gtk.OptionMenu — a widget used to provide a list of valid choices.

Synopsis

class gtk.OptionMenu(gtk.Button):
    gtk.OptionMenu()
def get_menu()
def set_menu(menu)
def remove_menu()
def get_history()
def set_history(index)

Ancestry

+-- gobject.GObject
  +-- gtk.Object
    +-- gtk.Widget
      +-- gtk.Container
        +-- gtk.Bin
          +-- gtk.Button
            +-- gtk.OptionMenu

gtk.OptionMenu Properties

gtk.Object Properties

gtk.Widget Properties

gtk.Container Properties

gtk.Button Properties

"menu"Read-WriteThe menu of options.

gtk.OptionMenu Style Properties

gtk.Widget Style Properties

gtk.Button Style Properties

"indicator-size"ReadThe size of the dropdown indicator
"indicator-spacing"ReadThe spacing around the indicator.

gtk.OptionMenu Signal Prototypes

gobject.GObject Signal Prototypes

gtk.Object Signal Prototypes

gtk.Widget Signal Prototypes

gtk.Container Signal Prototypes

gtk.Button Signal Prototypes

"changed" def callback(optionmenu, user_param1, ...)

Description

Warning

gtk.OptionMenu is deprecated in PyGTK 2.4; use the gtk.ComboBox instead.

A gtk.OptionMenu is a widget allows the user to choose from a list of valid choices from an associated menu. The gtk.OptionMenu displays the last selected choice. When activated (clicked) the gtk.OptionMenu displays a popup gtk.Menu which allows the user to make a new choice. Using a gtk.OptionMenu is simple:

Constructor

    gtk.OptionMenu()
Returns :a new optionmenu widget

Creates a new gtk.OptionMenu widget.

Methods

gtk.OptionMenu.get_menu

    def get_menu()
Returns :a menu widget or None if no menu is associated

The get_menu() method returns the menu that is associated with the optionmenu or None if no menu is associated.

gtk.OptionMenu.set_menu

    def set_menu(menu)
menu :a menu to be associated with the optionmenu

The set_menu() method associates the gtk.Menu widget specified by menu with the optionmenu thus providing the way for a user to select a new choice. A simple menu, avoiding the use of tearoff menu items, submenus, and accelerators, should be used.

gtk.OptionMenu.remove_menu

    def remove_menu()

The remove_menu() method removes the currently associated menu from the optionmenu.

gtk.OptionMenu.get_history

    def get_history()
Returns :the index of the selected menu item, or -1 if there are no menu items

The get_history() method returns the index of the currently selected menu item or -1 if there are no menu items. The menu items are numbered from top to bottom, starting with 0.

gtk.OptionMenu.set_history

    def set_history(index)
index :the index of the menu item to display as the selected optionmenu choice

The set_history() method selects the menu item specified by index as the displayed optionmenu choice.

Signals

The "changed" gtk.OptionMenu Signal

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

The "changed" signal is emitted when a new optionmenu choice is made.