[Tkinter-discuss] Please help -- Tkinter Scale widget with DoubleVar is acting weird

Michael Lange klappnase at web.de
Sat Aug 21 01:09:16 CEST 2004

On Fri, 20 Aug 2004 10:04:30 -0400
"Jared Cohen" <Jared.Cohen at noaa.gov> wrote:

> Thanks to both of you for your help. I already do have mechanisms in 
> place that prevent the callback from actually doing anything if the 
> variable has not really been changed. But the problem with that method 
> (and with both of your suggestions) is that even if the callback doesn't 
> do anything, it is still getting invoked when it shouldn't be. I was 
> simply trying to figure out WHY, because I felt that it would be more 
> elegant to completely stop the callback from getting invoked 
> incorrectly, than to allow it to be invoked and then have it return 
> without doing anything. But if that's not feasible, then I'll just have 
> to do it the other way :-)

Maybe you could bind your callback to ButtonRelease- and KeyRelease events
instead of using var.trace_variable() (or the scale's command option), however it
may be a little complicated to get exactly the behavior you want.
BTW, I noticed this behavior, too, on both python2.2.2 / tk8.3.3 and python2.3.3 / tk8.4.5;
unfortunately I don't have a clue, what's the reason for this either.


More information about the Tkinter-discuss mailing list