[Tkinter-discuss] Button

Alan Gauld alan.gauld at btinternet.com
Mon May 23 10:18:19 CEST 2011


"psao pollard-flamand" <psaoflamand at live.com> wrote

> You know when you click a tkinter button and the 
> window usually freezes until its done? 

Actually it doesn't *usually* freeze because most Tkinter 
apps are designed to prevent that :-)

> Does any one know how to stop that?

The key here is that GUI event handlers are intended 
to be short functions that do one thing at a time. If they 
have to do more intensive and time consuming actions 
then the event handler will either:
a) launch another function to do that, using a different 
     thread if necessary.
b) open a modal dialog that displays progress (or at 
    the very least a warning).

The objective should be to habd control back to the 
event loop as fast as possible so you can respond 
to the next event - which might, after all, be a cancel 
operation!

HTH,


-- 
Alan Gauld
Author of the Learn to Program web site
http://www.alan-g.me.uk/




More information about the Tkinter-discuss mailing list