[Tkinter-discuss] Tkinter-discuss Digest, Vol 15, Issue 5

Harlin Seritt harlinseritt at yahoo.com
Tue May 10 12:25:41 CEST 2005


I think this sort of thing is asked more in this list than anywhere else :-)
Try using Tk().after(milliseconds, function/method). Sure it can eat up some memory but it works pretty well.
 
Harlin Seritt

tkinter-discuss-request at python.org wrote:
Send Tkinter-discuss mailing list submissions to
tkinter-discuss at python.org

To subscribe or unsubscribe via the World Wide Web, visit
http://mail.python.org/mailman/listinfo/tkinter-discuss
or, via email, send a message with subject or body 'help' to
tkinter-discuss-request at python.org

You can reach the person managing the list at
tkinter-discuss-owner at python.org

When replying, please edit your Subject line so it is more specific
than "Re: Contents of Tkinter-discuss digest..."


Today's Topics:

1. Re: Tkinter and threading (Russell E. Owen)


----------------------------------------------------------------------

Message: 1
Date: Mon, 09 May 2005 12:04:34 -0700
From: "Russell E. Owen" 
Subject: Re: [Tkinter-discuss] Tkinter and threading
To: tkinter-discuss at python.org
Message-ID: 

In article ,
Vania Smrkovski wrote:

> Hello,
> New to this group, and I have not found much in the way of documentation 
> for advanced uses of Tkinter, yet. So far, Tk3k is the most advanced 
> resource I have found yet.
> I am trying to implement threading in my Tkinter app. I have managed to 
> get a button to fire an FTP download into one of my text areas, but to get 
> rid of the delay on the GUI while the FTP process was being handled, I 
> created a thread in the button\'s command handler....

You cannot safely make Tkinter from any thread other than the one that 
started the tkinter mainloop (i.e. your main thread unless you are doing 
something really weird).

As far as network communication goes, you have several options...
- Use the free "twisted framework". It integrates with Tkinter and other 
GUI toolkits, handles most of the standard protocols and is reported to 
be very good.

- For ftp, do the transfer in the background and poll the state. This is 
especially appropriate if you have multiple transfers since one polling 
loop can poll all of them. For an example see RO.Comm.FTPGet and the 
associated widget RO.Wdg.FTPLogWdg in the RO package 
.

- For TCP/IP use a tcl socket and use file events to handle incoming 
data and errors. This has the advantage of being asynchronous (and is 
completely cross platform unlike the a similar technique at the Tkinter 
level). For an example see RO.Comm.TCPConnection and the underlying 
RO.Comm.TkSocket.

-- Russell

P.S. there were rumors a few years ago that you could safely generate 
Tkinter events from a background thread and have the main thread handle 
them. However, I am pretty sure (based on my own tests) that it's not 
actually safe to do that. My suggestion is to NEVER deal with Tkinter or 
Tk from a background thread.



------------------------------

_______________________________________________
Tkinter-discuss mailing list
Tkinter-discuss at python.org
http://mail.python.org/mailman/listinfo/tkinter-discuss


End of Tkinter-discuss Digest, Vol 15, Issue 5
**********************************************

		
---------------------------------
Yahoo! Mail Mobile
 Take Yahoo! Mail with you! Check email on your mobile phone.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/tkinter-discuss/attachments/20050510/4e9ed0ad/attachment.htm


More information about the Tkinter-discuss mailing list