gtk.MenuShella base class for menu objects.Synopsisgtk.MenuShellgtk.Containerappendchildprependchildinsertchildpositiondeactivateselect_itemmenu_itemdeselectactivate_itemmenu_itemforce_deactivateselect_firstsearch_sensitivecancelset_take_focustake_focusget_take_focusAncestry+-- gobject.GObject
+-- gtk.Object
+-- gtk.Widget
+-- gtk.Container
+-- gtk.MenuShell
Implemented Interfacesgtk.MenuShell
implements
gtk.Buildablegtk.MenuShell Propertiesgtk.Object Propertiesgtk.Widget Propertiesgtk.Container Properties
"take-focus"Read-WriteIf True the menu and its submenus grab
the keyboard focus on popup. Default value: True.
Available in GTK+ 2.8 and above.
gtk.MenuShell Style Propertiesgtk.Widget Style Propertiesgtk.MenuShell Signal Prototypesgobject.GObject Signal Prototypesgtk.Object Signal Prototypesgtk.Widget Signal Prototypesgtk.Container Signal Prototypes"activate-current"callbackmenushellforce_hideuser_param1..."cancel"callbackmenushelluser_param1..."cycle-focus"callbackmenushelldirectionuser_param1..."deactivate"callbackmenushelluser_param1..."move-current"callbackmenushelldirectionuser_param1..."move-selected"callbackmenushelldistanceuser_param1..."selection-done"callbackmenushelluser_param1...DescriptionA gtk.MenuShell is
the abstract base class used to derive the gtk.Menu and gtk.MenuBar
subclasses. A gtk.MenuShell is
a container of gtk.MenuItem
objects arranged in a list which can be navigated, selected, and activated
by the user to perform application functions. A gtk.MenuItem can
have a submenu associated with it, allowing for nested hierarchical
menus.Methodsgtk.MenuShell.appendappendchildchild :The gtk.MenuItem to
add.The append() method adds a new gtk.MenuItem
specified by child to the end of the menu shell's
item list.gtk.MenuShell.prependprependchildchild :The gtk.MenuItem to
add.The prepend() method adds a new gtk.MenuItem
specified by child to the beginning of the menu
shell's item list.gtk.MenuShell.insertinsertchildpositionchild :The gtk.MenuItem to
add.position :The position in the item list where child
should be added. Positions are numbered starting from
0.The insert() method adds a new gtk.MenuItem
specified by child to the menu shell's item list at
the position specified by position. gtk.MenuShell.deactivatedeactivateThe deactivate() method deactivates the
menu shell. Typically this results in the menu shell being removed from the
screen.gtk.MenuShell.select_itemselect_itemmenu_itemmenu_item :The gtk.MenuItem to
select.The select_item() method selects the
menu item specified by menu_item from the menu
shell.gtk.MenuShell.deselectdeselectThe deselect() method deselects the
currently selected item from the menu shell, if any.gtk.MenuShell.activate_itemactivate_itemmenu_itemforce_deactivatemenu_item :The gtk.MenuItem to
activate.force_deactivate :If True, force the
deactivation of the menu shell after the menu item is
activated.The activate_item() method activates
the menu item specified by menu_item. If
force_deactivate is True the
menushell is forcibly deactivated after menu_item is
activated.gtk.MenuShell.select_firstselect_firstsearch_sensitivesearch_sensitive :if True, search for the
first selectable menu item, otherwise select nothing if the first
item isn't sensitive.This method is available in PyGTK 2.2 and above.The select_first() method selects the
first visible or selectable child of the menu shell if
search_sensitive is True. Don't
select tearoff items unless the only item is a tearoff item. If
search_sensitive is False select
nothing if the first item isn't sensitive.
search_sensitive should be False
if the menu is being popped up initially.gtk.MenuShell.cancelcancelThis method is available in PyGTK 2.4 and above.The cancel() method cancels the
selection within the menu shell.gtk.MenuShell.set_take_focusset_take_focustake_focustake_focus :if True, the menu shell should
take the keyboard focus on popup.This method is available in PyGTK 2.8 and above.The set_take_focus() method sets the
"take-focus" property to the value of take_focus. If
take_focus is True the menu shell
will take the keyboard focus so that it will receive all keyboard events to
enable keyboard navigation in menus.Setting the "take-focus" property to False is
useful only for special applications like virtual keyboard implementations
which should not take keyboard focus.The "take-focus" state of a menu or menu bar is automatically
propagated to submenus whenever a submenu is popped up, so you don't have to
worry about recursively setting it for your entire menu hierarchy. Only when
programmatically picking a submenu and popping it up manually, should the
"take-focus" property of the submenu be set explicitly.Note that setting it to False has side-effects:If the focus is in some other app, it keeps the focus and
keyboard navigation in the menu doesn't work. Consequently, keyboard
navigation on the menu will only work if the focus is on some toplevel owned
by the onscreen keyboard.To avoid confusing the user, menus with the "take-focus"
property set to False should not display mnemonics or
accelerators, since they may not work.Also see the gtk.gdk.keyboard_grab()
function for more information.gtk.MenuShell.get_take_focusget_take_focusReturns :True if the men shell will
take keyboard foucs on popup.This method is available in PyGTK 2.8 and above.The get_take_focus() method returns the
value of the "take-focus" property. See the set_take_focus()
method for more information.SignalsThe "activate-current" gtk.MenuShell Signalcallbackmenushellforce_hideuser_param1...menushell :the menushell that received the
signalforce_hide :if True, hide the menu after activating the
menu item.user_param1 :the first user parameter (if any) specified
with the connect()
method... :additional user parameters (if
any)The "activate-current" signal is emitted to activate the current
menu item in the menushell.The "cancel" gtk.MenuShell Signalcallbackmenushelluser_param1...menushell :the menushell that received the
signaluser_param1 :the first user parameter (if any) specified
with the connect()
method... :additional user parameters (if
any)The "cancel" signal is emitted to cancel the selection in the
menushell. Also causes the "selection-done" signal
to be emitted. The "cycle-focus" gtk.MenuShell Signalcallbackmenushelluser_param1...menushell :the menushell that received the
signaldirection :the direction to cycle the focus; one of:
gtk.DIR_TAB_FORWARD,
gtk.DIR_TAB_BACKWARD, gtk.DIR_UP,
gtk.DIR_DOWN, gtk.DIR_LEFT or
gtk.DIR_RIGHTuser_param1 :the first user parameter (if any) specified
with the connect()
method... :additional user parameters (if
any)The "cycle-focus" signal is emitted when an action occurs requesting the focus move to the next menubar.The "deactivate" gtk.MenuShell Signalcallbackmenushelluser_param1...menushell :the menushell that received the
signaluser_param1 :the first user parameter (if any) specified
with the connect()
method... :additional user parameters (if
any)The "deactivate" signal is emitted when the menushell is
deactivated.The "move-current" gtk.MenuShell Signalcallbackmenushelldirectionuser_param1...menushell :the menushell that received the
signaldirection :the direction to move; one of:
gtk.MENU_DIR_PARENT,
gtk.MENU_DIR_CHILD, gtk.MENU_DIR_NEXT
or gtk.MENU_DIR_PREVuser_param1 :the first user parameter (if any) specified
with the connect()
method... :additional user parameters (if
any)The "move-current" signal is emitted when the current menu item
is to be moved in the direction specified by
direction which is one of:gtk.MENU_DIR_PARENTTo the parent menu shell.gtk.MENU_DIR_CHILDTo the submenu, if any, associated with the
item.gtk.MENU_DIR_NEXTTo the next menu item.gtk.MENU_DIR_PREVTo the previous menu item.The "move-selected" gtk.MenuShell Signalcallbackmenushelldistanceuser_param1...menushell :the menushell that received the
signaldistance :+1 to move to the next item,
-1 to move to the previoususer_param1 :the first user parameter (if any) specified
with the connect()
method... :additional user parameters (if
any)This signal is available in GTK+ 2.12 and above.The "move-selected" signal is emitted to move the selection to another item.The "selection-done" gtk.MenuShell Signalcallbackmenushelluser_param1...menushell :the menushell that received the
signaluser_param1 :the first user parameter (if any) specified
with the connect()
method... :additional user parameters (if
any)The "selection-done" signal is emitted when a selection has been
completed within a menu shell.