Am Donnerstag, den 16.12.2004, 08:26 +0300 schrieb Eugene Morozov:
> Marcus Habermehl wrote:
> > Hi.
> > 
> > I want to add an accelerator to my gtk.Window().
> > 
> > After I read the pygtk reference several hours I meant this is the right
> > way.
> > 
> 
> I use the following code:
> 
>    accelgroup = gtk.AccelGroup()
>    key, modifier = gtk.accelerator_parse('<Alt>%d' % i)
>    accelgroup.connect_group(key, modifier, gtk.ACCEL_VISIBLE, 
>                             lambda a,b,c,d,i=i: self.assess_quality(i))
>    recall_card_window.add_accel_group(accelgroup)
> 
> Don't know whether it's right or wrong, but it works.

Thanks! I've modified your example a little bit.

def Quit(*args):
    gtk.main_quit()

accelgroup = gtk.AccelGroup()
key, modifier = gtk.accelerator_parse('<Control>q')
accesgroup.connect_group(key, modifier, gtk.ACCEL_VISIBLE, Quit)
window1.add_accel_group(accelgroup)

Greetings
Marcus

_______________________________________________
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