Re: button -state disable gets queued???
Available news archives: comp.lang.tcl - comp.lang.python - comp.security.firewalls - sci.crypt - comp.lang.php - comp.lang.javascript
Google
 
Web news.hping.org


comp.lang.tcl archive

Re: button -state disable gets queued???

From: <slebetman@yahoo.com>
Date: Mon Feb 27 2006 - 11:03:15 CET

Andreas Leitgeb wrote:
> Eric Taylor <et2@rocketship1.com> wrote:
> > Thanks, the updates seem to do the trick, ...
>
> >> Andreas Leitgeb wrote:
> >> > You could try:
> >> > after idle { button -state normal -background <whatitwasbefore> }
>
> >slebetman wrote:
> >> Alternatively just call update to force Tk to process the event loop:
> >> update
> >> button -state normal -background <whatitwasbefore>
>
>
> In the long run, I think that the "after idle ..." version
> will make you happier.

Depends on the code. You cannot generalise this since [after idle ...]
may result in more complicated code since the bit of code that gets
executed by after will be in a different context. In this specific case
a simple 'update' is clearly better than 'after'.

My personal rule is to use 'after' only if I want to schedule something
since that is what is was designed to do. I use 'update' to process the
event loop since that is what it does. You get finer control of what
tasks in the event loop gets executed with update since you can specify
to only process idletasks. But in this case which involves GUI elements
you should call plain old update since some GUI related stuff are not
queued as idle tasks.
Received on Sun Apr 30 02:16:42 2006