Why is it that some components won't accept key_*_events? My particular
concern is GtkDrawingArea, but it is far from alone in this. For example,
using the scribble.py example distributed with PyGTK, the following
medification fails to generate any events when pressing keys:

        drawing_area.connect("configure_event", configure_event)
        drawing_area.connect("motion_notify_event", motion_notify_event)
        drawing_area.connect("button_press_event", button_press_event)
+       drawing_area.connect("key_press_event", button_press_event)
        drawing_area.set_events(GDK.EXPOSURE_MASK |
                                GDK.LEAVE_NOTIFY_MASK |
                                GDK.BUTTON_PRESS_MASK |
+                               GDK.KEY_PRESS_MASK |
                                GDK.POINTER_MOTION_MASK |
                                GDK.POINTER_MOTION_HINT_MASK)


(If you want to try this, make sure you put a print statement in
button_press_event or you may not notice that events are generated.)

Am I:   1) Doing this wrong?
        2) Looking at a bug?
        3) Just plain stupid? 

I know the events get sent to the containing Window, but I don't want
that. How am I then supposed to extend existing components? "In order to
instantiate this Component, you need to supply a reference to the window."
That won't do.

Anders "Quest" Qvist
NetGuide Scandinavia

And we who listen to the sky, or walk the dusty grade,
Or break the very atoms down, to see how they are made,
Or study cells, or living things, seek truth with open hand;
The profoundest act of worship is to try to understand.

-- Catherine Faber, "The Word of God"

To unsubscribe: echo "unsubscribe" | mail [EMAIL PROTECTED]

Reply via email to