Tkinter listener thread?

Eric Brunel eric_brunel at despammed.com
Fri Jan 27 04:03:07 EST 2006


On Thu, 26 Jan 2006 17:32:32 +0000, Steve Holden <steve at holdenweb.com>  
wrote:

> gregarican wrote:
>> I have a Python UDP listener socket that waits for incoming data. The
>> socket runs as an endless loop. I would like to pop the incoming data
>> into an existing Tkinter app that I have created. What's the
>> easiest/most efficient way of handling this? Would I create a separate
>> thread that has the listener set a certain Tkinter variable if there is
>> incoming data? Any suggestions would be tremendously appreciated :-)
>>
>
> http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/82965

There's in fact no need to check regularly if there's something in the  
Queue: the secondary thread can post a tk custom event to trigger the  
treatment automatically from within the main GUI loop. See here:
http://minilien.fr/a0k273

HTH
-- 
python -c "print ''.join([chr(154 - ord(c)) for c in  
'U(17zX(%,5.zmz5(17;8(%,5.Z65\'*9--56l7+-'])"



More information about the Python-list mailing list