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

Jeff Epler jepler at unpythonic.net
Mon Aug 23 10:31:18 EDT 2004


I looked into this some more, and was able to reproduce the problem
using
    tcl-8.3.5-88
    redhat-release-9-3
I was then also able to demonstrate it on tcl/tk 8.5.

I used this wish script:
    scale .s -variable v -resolution 0.1 -from 0 -to 1
    trace variable v w changed
    proc changed {args} { global v; puts "v changed.  new value: $v" }
    pack .s

I set the scale value to 0.7.  Now, by moving the cursor *between the
slider and the trough*, I get the repeated message "v changed.  new value:
0.7".  (It's the movement between slider and trough, not just hovering,
that made the redundant sets happen for me)

This behavior doesn't seem to depend on the value of tcl_precision.

It *looks* like the problem is in TkRoundToResolution().  It returns
a slightly different value than the incoming value, so that the test
"scalePtr->value == value" in tkUnixScale:TkpSetScaleValue() fails and
it falls through to a Tcl_SetVar call.  This is low-level stuff inside
of tk.  Like Fredrik suggested, your next step is to go to the tcl/tk
community with your report, if it's important to you.

Jeff
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 196 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/python-list/attachments/20040823/ec8eed35/attachment.sig>


More information about the Python-list mailing list