[pygtk] [GDK] event.type == gtk.gdk.NOTHING

Bjartur Thorlacius svartman95 at gmail.com
Mon Dec 12 01:27:42 WST 2011


There seems to be a bug in PyGTK. GDK events always seem to be of type  
gtk.gdk.NOTHING. Rough demonstration follows:

def PropertyNotify(ev, (rootwin)):
   stderr.write(repr(ev.type) + "\n") #prints nothing but <enum GDK_NOTHING  
of type GdkEventType>
   return gtk.gdk.FILTER_CONTINUE

rootwin = gtk.gdk.get_default_root_window()
rootwin.set_events(gtk.gdk.PROPERTY_CHANGE_MASK | rootwin.get_events())
rootwin.add_filter(PropertyNotify, (rootwin))


Others have also encountered and got confused by the behavior, e.g. m . c  
. wilkins wrote on this ML:
> The only problem with this is that event.type is always
> <enum GDK_NOTHING of type GdkEventType>
> and I don't receive all events, [snip]

Matt Wilkins and others have reportedly received some of the events they  
listened for, but had to disambiguate them with heuristics. I have not  
noticed any PROPERTY_NOTIFY events myself, but I do not know whether that  
stems from a bug in PyGTK or my misreading of the reference manual.

Is there any way to circumvent or fix this issue? Should I perhaps wrap  
rootwin in a gtk.Window? I tried skimming gdkevent.override, but I am no  
GObject or GTK+ programmer.

-- 
-,Bjartur


More information about the pygtk mailing list