Process pending Tk events from GObject main loop?

Christian Gollwitzer auriocus at gmx.de
Fri Oct 11 15:58:30 EDT 2013


Am 11.10.13 14:52, schrieb Skip Montanaro:
> I know I have things bassackwards, but trying to process Gtk events
> from Tkinter's main loop using after() isn't working. (I suspect our
> underlying C++ (ab)use of Gtk may require a Gtk main loop). I'd like
> to process Tk events periodically from a GObject main loop. I know I
> want to call gobject.idle_add(), but can't find Tkinter equivalent to
> gobject.MainLoop().get_context().iteration(). That is, how do you
> process a single event (or all pending events)? It looks like
> _tkinter.dooneevent() might be the right call to process a single
> event, but how do I tell no more events are pending?

To process all pending events in Tcl/Tk, you use update (Tcl function). 
So you just grab a Tkinter object and execute its .update() function, or 
you manually invoke something like

	root.tk.eval('update')

Christian



More information about the Python-list mailing list