I have successfully added keyboard shortcuts (AccelGroups) to menu functions before by using the well-known gtk.ItemFactory methods.

For various and embarassing reasons, I cannot use the Factory call in my current program, and I'm having a hard time getting the shortcuts to work.

Here's what I'm trying to do:

    #Unsuccessful attempt to add key bindings
    accel = AccelGroup()
    for child in menus["file"].menu.get_children():
        if child.get_children()[0].get_text() == 'Load...':
            child.add_accelerator("activate",accel,ord("o"),
                                  CONTROL_MASK,0)


It's obviously ugly code, I realize, and the convoluted way that I have to figure out which menu child is the Load function makes me think I'm doing something really bone-headed.


But, worse than being ugly, this code also doesn't work, and I just can't figure out why. Could some kind soul take pity on me and show me the light?

Thanks in advance.

R.

Rick Muller
[EMAIL PROTECTED]


_______________________________________________ pygtk mailing list [EMAIL PROTECTED] http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/

Reply via email to