gtk.OptionMenu
gtk.OptionMenu — a widget used to provide a list of valid choices.
Description
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
Returns : | a new optionmenu widget |
Creates a new gtk.OptionMenu
widget.
Methods
gtk.OptionMenu.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
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
The remove_menu() method removes the
currently associated menu from the optionmenu.
gtk.OptionMenu.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
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.