I want the behavior of a button to be different depending on whether a
modifier key is pressed when that button is pressed. I haven't
succeeded yet in capturing the keys pressed. The bottom lives in a
gtk.Toolbar.
I have tried various incantations suggested by the FAQ, eg, using an
event box, to no avail
iconw = gtk.Image()
iconw.set_from_stock(gtk.STOCK_GO_BACK, iconSize)
self.bLeft = self.append_item(
'Left',
'Move back in time',
'Private',
iconw,
self.panx,
0)
def key_press(widget, key):
print 'press', key
def key_release(widget, key):
print 'release', key
ebox = gtk.EventBox()
ebox.add(self.bLeft)
ebox.add_events(gdk.KEY_PRESS_MASK|gdk.KEY_RELEASE_MASK)
self.bLeft.add_events(gdk.KEY_PRESS_MASK|gdk.KEY_RELEASE_MASK)
self.bLeft.connect("scroll_event", self.panx)
ebox.connect("key_press_event", key_press)
ebox.connect("key_release_event", key_release)
The 'scroll_event' works with no extra schenanigans, but I am not
getting any key_press or key_release events.
Any ideas?
Thanks, John Hunter
_______________________________________________
pygtk mailing list [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/