On Wed, Feb 11, 2004 at 04:30:28PM -0700, Rick Muller wrote:
> 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.
Hmmm. Two hints that *may* be relevant to your problem:
a) AFAIK, an AccelGroup needs to be attach()ed to a GtkWindow for it
to do anything useful. It could be that the Factory already does
this for you..
b) There *should* be a way of getting the accelerator keyval from the
actual label; for instance, the `old' GtkLabel had a parse_uline()
method that would return the keyval for the accelerator key.
Ah, I see it's been deprecated. Hmm, what are you supposed to use
in place of it?
Take care,
--
Christian Robottom Reis | http://async.com.br/~kiko/ | [+55 16] 261 2331
_______________________________________________
pygtk mailing list [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/