Statement orders

jepler at jepler at
Sun Oct 2 22:54:50 CEST 2005

> would it be advisable to guard against this with something like this?
> def perform_longrunning_calculation():
>      if not app.busy:
>          app.busy = 1
By using that kind of construct, instead of using update_idletasks(), 
you force all code to be aware of and manage the app.busy flag.

Another difference is that with the original code changed to use
update_idletasks(), perform_longrunning_calculation *will* be called
twice, the second time after the first one completes.  With your code,
it will be called once if the second keypress comes within one second, and
twice if called after one second is up. (though a second update before setting
busy back to false will make it be called only once)

So in also depends on what you want your application to do in these cases.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 196 bytes
Desc: not available
URL: <>

More information about the Python-list mailing list