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.odonn...@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>
_______________________________________________
Tkinter-discuss mailing list
Tkinter-discuss@python.org
http://mail.python.org/mailman/listinfo/tkinter-discuss

Reply via email to