[Python-Dev] Event loops, PyOS_InputHook, and Tkinter

"Martin v. Löwis" martin at v.loewis.de
Mon Nov 14 09:07:50 CET 2005


Michiel Jan Laurens de Hoon wrote:
> If, however, Python contains an event loop that takes care of events as 
> well as Python commands, redrawing won't happen until Python has 
> executed all plot commands -- so no repainting in vain here.

Ah, I think now I understand the problem. It seems that you don't care
at all about event loops. What you really want to know is "when is
Python idle?", by "being idle" defines as "there are no commands being
processed at the interactive interpreter", or perhaps "there are no
commands being processed in the main thread", or perhaps "there are no
commands being processed in any thread".

Is that a correct problem statement? If so, please don't say that you
want an event loop. Instead, it appears that you want to hook into
the interpreter loop.

As others have commented, it should be possible to get nearly the
same effect without such hooking. For example, if you chose to
redraw at most 10 times per second, you will still get good
performance. Alternatively, you could chose to redraw if there was
no drawing command for 100ms.

Regards,
Martin


More information about the Python-Dev mailing list