On Tue, 12 Dec 2000, Martin Grimme wrote:
> Hello,
>
> I built a widget containing a GtkLayout with a GtkDrawingArea
> in it. The widget class is derived from GTKLayout.
> Now my problem is that I need to connect "key_press_events"
> to this widget which doesn't seem to work as the widget
> cannot receive focus.
It may be that the widget is not selecting key events (which is different
from focus handling). You can add to the event mask with the add_events
method:
widget.add_events(gtk.GDK.KEY_PRESS_MASK | gtk.GDK.KEY_RELEASE_MASK)
You can set or unset the the CAN_FOCUS flag on a widget as well:
widget.set_flags(gtk.CAN_FOCUS)
widget.unset_flags(gtk.CAN_FOCUS)
>
> Is there any way to implement this functionality by only
> using Python/PyGTK?
>
> The next problem is the other way round...
> Can I tell widgets which receive focus and thus catch key
> presses not to accept focus? GtkScale is the focus-taking
> widget of which I want that it ignores key presses
> (but acts on mouse clicks).
unset the CAN_FOCUS flag.
James
_______________________________________________
pygtk mailing list [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk