[pygtk] Popup menu and accelerators
Sebastian Pölsterl
marduk at k-d-w.org
Thu Mar 30 16:39:31 WST 2006
John Finlay wrote:
> Sebastian Pölsterl wrote:
>> Hi!
>>
>> I generate a popup menu with gtk.UIManager and want to add accellerators
>> to the menu's items. If I press one of the key combinations the right
>> function will be called, but the popup menu itsself doesn't show the
>> combination next to the item. In the end it should look like
>> http://developer.gnome.org/projects/gup/hig/2.0/images/file-menu.png
>> But currently, Ctrl+N etc. on the right are missing.
>>
>> Here is my code:
>> [...]
>>
>>
> Try adding the accelerators when adding actions to the actiongroup, for
> example:
>
> self.actiongroup.add_actions([('View', None, _('View'),
> '<Control>V',
> None, self.on_treeview_browse_movies_row_activated),
> ('Edit', gtk.STOCK_EDIT, _('Edit'),
> None, None,
> self.on_toolbutton_edit_clicked),
> ('Delete', gtk.STOCK_DELETE,
> _('Delete'), None, None,
> self.on_toolbutton_delete_clicked)])
>
> You also have to get the uimanager accelgroup and add it to the toplevel
> window before inserting the actiongroup in the uimanager. See the
> uimanager.py example program in the tutorial:
>
> http://www.pygtk.org/pygtk2tutorial/sec-UIManager.html#sec-SimpleUIManagerExample
>
> John
It doesn't work the way either. Key combination work, but they won't get
displayed.
I tried the same thing with a menubar instead of a popup and their it works.
--
Greetings,
Sebastian Pölsterl
More information about the pygtk
mailing list