[pygtk] Re: keyboard emulation with button

Fabrizio Pollastri pollastri at iriti.cnr.it
Fri Mar 3 01:11:58 WST 2006


I have found it.
The "CRITICAL" assertions are caused by the missing "window" attribute 
of gtk.gdk.Event. So the correct code is

...

# the event of pressing a key with key value "A"
event =   gtk.gdk.Event(gtk.gdk.KEY_PRESS)
event.keyval = ord("A")
event.window = gtk.gdk.get_default_root_window()

...

The event.window assignment must come after the declaration of the root 
window, i.e. after "window = gtk.gdk.Window()", or when this in not 
explicit, like happens when using Glade generated files, after the call 
to gtk.glade.XML that contains the root window.


Cheers,
F. Pollastri


More information about the pygtk mailing list