Hi.key press events are sent to the widget with the keyboard focus, which is not necessarily the same as the widget the mouse is over.
I'm using python-gtk2 1.99.17-3 on debian.
The problem is that i can't get keypress events, and, i'm getting the button-press-events in right way.
I'm tryng to get them, on a subclass of gtk.DrawingArea. The code is this:
self.connect("expose-event", self.area_expose_cb) self.add_events(gtk.gdk.BUTTON_PRESS_MASK) self.add_events(gtk.gdk.KEY_PRESS) self.connect("button_press_event",self.someevent) self.connect("key_press_event",self.someevent) #self.connect("key-press-event",self.keyevent)
I'm not too familiar with python-gtk, i make all the tests that could help. the first: button-press-event works correctly.
I tried without the button_press.. Also i tried wrapping my DA subclass on a gtk.EventBox..
but keeps failing.
Well.. any help would be appreciated.
Now i'm going to check te value of gtk.gdk.KEY_PRESS.
You can mage a drawing area focusable like this: drawing_area.set_flags(gtk.CAN_FOCUS) You can then set the widget as the focus widget for the window like this: drawing_area.grab_focus()
James.
-- Email: [EMAIL PROTECTED] WWW: http://www.daa.com.au/~james/
_______________________________________________ pygtk mailing list [EMAIL PROTECTED] http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/
