On Tue, May 14, 2002 at 07:43:51PM +0100, Graham Ashton wrote:
> 
> I ask because there is a bug in the example code in 3.2; the print
> statement in wakeup() has bad variable substitution formats in it. This
> would do nicely (for PyGTK 0.6.x):
> 
>     def wakeup( widget, event, *args ):
>         print "Event %d woke me up" % event.type

Oops. I changed that at the last minute :-)

> I think that question 3.3 might benefit from a link to the GtkEventBox
> widget too, incase people are trying to bind events to a widget that
> doesn't have it's own X window.

Okay. Anybody know precisely which widgets lack X windows?

> I notice that to capture a key press you don't specify
> GDK.KEY_PRESS_MASK, yet you can still connect the window to the
> key_press_event. Why does this work? 

The window widget listens to the key press events by default, so it
isn't necessary. You can look in the GTK+ source code to see what the
defaults are:

gtkwindow.c:1103

  attributes.event_mask |= (GDK_EXPOSURE_MASK |
                            GDK_KEY_PRESS_MASK |
                            GDK_ENTER_NOTIFY_MASK |
                            GDK_LEAVE_NOTIFY_MASK |
                            GDK_FOCUS_CHANGE_MASK |
                            GDK_STRUCTURE_MASK);

So as you see it already has the key press mask as default. 

In theory, you could check which events a widget receives by default
with get_events() - note that it is a bitmap and you would have to
decode it according to the GTK.py _MASK constants. However, this seems
to return 0 for any newly-realized widget. Why?

> While we're on the subject of key snooping, why doesn't PyGTK have a
> binding to the GTK+ global key snooper, which would surely be a better
> way to do all this? Is it just that nobody needed it?

Global key snooper? What's this?

Take care,
--
Christian Reis, Senior Engineer, Async Open Source, Brazil.
http://async.com.br/~kiko/ | [+55 16] 272 3330 | NMFL
_______________________________________________
pygtk mailing list   [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/

Reply via email to