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


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


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

Implemented Interfaces

gtk.OptionMenu implements gtk.Buildable

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


def callback(optionmenu, user_param1, ...)



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:



Returns :

a new optionmenu widget

Creates a new gtk.OptionMenu widget.



    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.


    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.


    def remove_menu()

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


    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.


    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.


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.