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

Michiel Jan Laurens de Hoon mdehoon at c2b2.columbia.edu
Mon Nov 14 02:25:18 CET 2005


Noam Raphael wrote:

>On 11/13/05, Greg Ewing <greg.ewing at canterbury.ac.nz> wrote:
>  
>
>>Noam Raphael wrote:
>>    
>>
>>>All that is needed to make Tkinter and Michiels'
>>>code run together is a way to say "add this callback to the input
>>>hook" instead of the current "replace the current input hook with this
>>>callback". Then, when the interpreter is idle, it will call all the
>>>registered callbacks, one at a time, and everyone would be happy.
>>>      
>>>
>>Except for those who don't like busy waiting.
>>    
>>
>I'm not sure I understand what you meant. If you meant that it will
>work slowly - a lot of people (including me) are using Tkinter without
>a mainloop from the interactive shell, and don't feel the difference.
>It uses exactly the method I described.
>  
>
This depends on what kind of extension module you run. I agree, for 
Tkinter you probably won't notice the difference -- although you are 
still wasting processor cycles. However, if graphics performance is 
important, busy-waiting is not ideal.

--Michiel.

-- 
Michiel de Hoon
Center for Computational Biology and Bioinformatics
Columbia University
1150 St Nicholas Avenue
New York, NY 10032




More information about the Python-Dev mailing list