[pygtk] problems with accelerators and UIManager

Eike Nicklas lists at ephys.de
Sat Dec 15 02:47:12 WST 2007


Hi John,

thanks for your quick reply!

On Fri, 14 Dec 2007 02:24:02 -0800 John Finlay wrote:

> Eike Nicklas wrote:
> > Hi all,
> >
> > I am currently learning Python and PyGTK by programming a simple
> > application and noticed a strange behaviour of accelerators in
> > connection with UIManager:
> >
> > In my program, I use UIManager to create a toolbar, but I don't use a
> > menu. Everything seems to work fine except for the accelerators.
> > A reduced version of my code is attached.
> >
> >   
> Actions only automatically connect accelerators when connecting to a 
> menuitem proxy. The "strange" behaviour results from the toolbar 
> creating an overflow menu for items that can't be displayed. The action 
> accelerators are automatically connected for proxy items in the overflow 
> menu.

Ah, ok, I thought actions would also automatically connect to toolbars.
That explains a lot.

> 
> >
> > What is the reason for this strange behaviour? Is there a way to use
> > accelerators when creating only a toolbar but not a menu?
> >
> >   
> Try connecting the accelerators to the actions manually with something like:
> 
>     for action in action_group.list_actions():
>         action.connect_accelerator()
> 
> after you create the toolbar.
> 

Everything works perfectly now. Thanks a lot for you help!

Eike


More information about the pygtk mailing list