Le 23/02/2017 à 15:57, John Lane a écrit :
> […]
> 
> The UIManager provides the menu bar, a few items in the bar each leading
> to menus containing a few items. The user can click operate the menu
> with a mouse and selecting a menu item triggers a callback that prints
> the name of the selected item. Nothing special thus far, but it works.
> 
> Once the user has clicked on a menu bar item with the mouse, she can
> then navigate the menu with the keyboard (or continue using the mouse).
> 
> I have wired up a global key binding using the 'keybinder' module and
> receive a callback when a mapped key is pressed.

Sounds odd to do that manually.  Do you know about mnemonic keys?
Basically if you mark some part of the label to be the mnemonic letter,
you'll be able to trigger that element with Alt+letter.

Additionally, F10 already pops up the first menu of the window's menubar.

> […]
> 
> How can I trigger the menu activation (like a mouse click does) ?

Read https://developer.gnome.org/gtk3/stable/GtkMenuShell.html and use
Gtk.MenuShell.select_item().  As menubars and menus are shells, assuming
Eric's sample, use:

    self.menubar1.select_item(self.menuitem1)

instead of manually poping the menu up.

But still, you should consider using memnonics

Regards,
Colomban
_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Reply via email to