[Tkinter-discuss] Button
Peter Milliken
peter.milliken at gmail.com
Wed May 18 23:14:57 CEST 2011
Michael offers excellent solutions.
When the work being done is cpu intensive (and the application allows :-)),
I often use threading i.e. the button runs a command that starts a Python
thread which goes off and does what needs to be done.
If the job being performed is that intensive then you probably want GUI
elements to show progress - in which case you can communicate to the thread
via pipes/queues and run another task that looks after the "communications"
and is responsible for updating GUI elements - such as progress bars.
I do this sort of thing a lot in my GUI's - just depends on what you are
doing though. But threading isn't for everyone - if you are used to straight
"linear" thinking in your programming then threads can take a bit of mind
bending to get your head around - but once you have then all problems seem
to be solved better through using threads :-)
On Thu, May 19, 2011 at 2:08 AM, Michael O'Donnell
<michael.odonnell at uam.es>wrote:
> <snip>
>
> if the work done by the command invoked by the button is quite cpu
> intensive,
> I do somethink like the following:
>
> <snip>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tkinter-discuss/attachments/20110519/1cf5115a/attachment.html>
More information about the Tkinter-discuss
mailing list