Hi, I'm trying to trap a key-press-event in a Layout.
I've previously successfully trapped the event in an Entry, but now I
need to trap it in the surrounding Layout. The attached minimal code
does not work, why?
Regards Tobias
import gtk
import pygtk
def cb_key_press(widget, event):
print "key pressed"
def cb_button_press(widget, event):
print "mbutton pressed"
window = gtk.Window(gtk.WINDOW_TOPLEVEL)
window.connect("delete-event", lambda w, e: gtk.main_quit())
l = gtk.Layout()
l.set_size_request(320,240)
l.connect("key-press-event", cb_key_press)
l.connect("button-press-event", cb_button_press)
l.set_events(gtk.gdk.KEY_PRESS_MASK | gtk.gdk.BUTTON_PRESS_MASK)
window.add(l)
l.show()
window.show()
gtk.main()_______________________________________________
pygtk mailing list [email protected]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/