[pygtk] keyboard emulation with button

Rafael Villar Burke pachi at mmn-arquitectos.com
Wed Mar 1 00:10:24 WST 2006


Fabrizio Pollastri escribió:
> I am trying to emulate a keyboard with gtk buttons to entry some text 
> into a gtk.Entry. All works fine, but I get the following errors.
>
> (myprogram.py:2165): Gdk-CRITICAL **: gdk_drawable_get_display:
> assertion `GDK_IS_DRAWABLE (drawable)' failed
>
> (myprogram.py:2165): Gdk-CRITICAL **: gdk_keymap_get_for_display:
> assertion `GDK_IS_DISPLAY (display)' failed
I try to guess here, but you probably have this problem due to the 
key_press event being generated before the gtk+ loop is started and the 
needed resources have been allocated. I can imagine gtk+ tries to 
determine from which display and drawable the event is generated, and it 
can't succeed for the former reasons.

I'd try to do the event generation after the window has been realized 
using an on_realize callback for it (maybe the configure stage is enough 
for the job too).

Good luck,

Rafael Villar Burke



More information about the pygtk mailing list