[pygtk] Can't get key-press-events..
Hi. I'm using python-gtk21.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. Thanks a lot. david -- + There is no dark side of the moon really. Matter of fact it's all dark. ___ pygtk mailing list [EMAIL PROTECTED] http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/
[pygtk] Can't get key-press events..
Well.. main window seems to get the events.. so it should be some focus-related issue, i mean, i only have that widget, but never setup the focus.. so .. that should be.. david -- + There is no dark side of the moon really. Matter of fact it's all dark. ___ pygtk mailing list [EMAIL PROTECTED] http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/
Re: [pygtk] Can't get key-press-events..
On 27/08/2003 6:58 AM, alejandro david weil wrote: Hi. I'm using python-gtk21.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. 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. 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/