I am emulating a keyboard with gtk buttons. To entry some text into a gtk.Entry, I first set the focus on the gtk.Entry and then I press the buttons. Keypad input works as expected (the keypad character appears into gtk.Entry), but gtk complains with the following two messages at each button pressing.

(myprogram.py:21650): Gdk-CRITICAL **: gdk_drawable_get_display: assertion `GDK_IS_DRAWABLE (drawable)' failed

(myprogram.py:21650): Gdk-CRITICAL **: gdk_keymap_get_for_display: assertion `GDK_IS_DISPLAY (display)' failed

My code is the following.

This is the callback code for the button press event.

event = gtk.gdk.Event(gtk.gdk.KEY_PRESS)
event.keyval = ord(key_associated_with_pressed_button)
keypad_widget.get_toplevel().get_focus().emit("key_press_event",
        event)

Last row suppose that the keypad input must be directed to any widget having the focus in the same top level window. In my case, the widget is a gtk.Entry.

Thanks in advance for any help.


Fabrizio Pollastri



_______________________________________________
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