On 2006-01-26, Steve Holden <st***@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/Coo...n/Recipe/82965
That seems a bit complex. Why not just register the file
descriptor and read-handler with Tk?
http://www.faqts.com/knowledge_base/view.phtml/aid/3728
That way the read-handler gets called by Tk's event loop
anytime there's receive data waiting. No extra thread, no
synchronization worries.
If the read-handler takes a _long_ time to complete, it does
make your GUI pause, so that may be a concern.
Unless tk.createfilehandler isn't supported no Wni32
platforms??
--
Grant Edwards grante Yow! Gee, I feel kind of
at LIGHT in the head now,
visi.com knowing I can't make my
satellite dish PAYMENTS!