Tk Source Code

View Ticket
Login
Bounty program for improvements to Tcl and certain Tcl packages.
2016-03-07
21:03 Closed ticket [2262543f]: Scale widget unexpectedly fires command callback plus 6 other changes artifact: 75a6ef91 user: fvogel
21:01
Fixed bug [2262543] - Scale widget unexpectedly fires command callback (cherrypicked [3c1a8559dd]) check-in: 887e7b28 user: fvogel tags: core-8-6-branch
21:00
Fixed bug [2262543] - Scale widget unexpectedly fires command callback check-in: 3c1a8559 user: fvogel tags: trunk
2016-02-24
17:36 Ticket [2262543f] Scale widget unexpectedly fires command callback status still Open with 8 other changes artifact: e23f9f89 user: fvogel
17:32
Fixed bug [2262543] - Scale widget unexpectedly fires command callback Closed-Leaf check-in: 091c6063 user: fvogel tags: bug-2262543fff
17:19
Added tests cases for bug [2262543] - Scale widget unexpectedly fires command callback check-in: 135fd292 user: fvogel tags: bug-2262543fff
2008-11-11
21:00 Ticket [2262543f] Scale widget unexpectedly fires command callback status still Open with 4 other changes artifact: 316e4211 user: nobody
21:00 Add attachment test_scalefire.py to ticket [2262543f] artifact: 82c7669e user: [email protected]
14:00 New ticket [2262543f] Scale widget unexpectedly fires command callback. artifact: 1d54670b user: nobody

Ticket UUID: 2262543
Title: Scale widget unexpectedly fires command callback
Type: Bug Version: obsolete: 8.4.19
Submitter: nobody Created on: 2008-11-11 14:00:20
Subsystem: 15. [scale] Assigned To: fvogel
Priority: 6 Severity: Minor
Status: Closed Last Modified: 2016-03-07 21:03:16
Resolution: Fixed Closed By: fvogel
    Closed on: 2016-03-07 21:03:16
Description:
The Tk scale widget (used through the Python/Tkinter interface) fires its command unexpectedly when it is initialized with a value.  This behavior is different then say, a checkbox, which can be initialized with a value without triggering the command callback.  I'm attaching a script which shows this behavior.

scale1 is initialized with a value through the variable option.  The command callback for scale1 fires unexpectedly when the mainloop starts.  I say unexpectedly, because the value of the scale is never changed from its initial value (at least from the user/coders point of view).

scale2 is initialized without a command callback.  The command callback is registered AFTER the value is changed, yet the callback still fires upon entering mainloop.

Both of these behaviors strike me as unexpected, and contrary to how the command callback is typically used for other widgets.  Also in the test script are two checkbuttons that are initialized in similar fashion to the scale widgets above, and you can see that their command callbacks do not fire.

This issue was discussed on the Tkinter mailing list: http://mail.python.org/pipermail/tkinter-discuss/2008-November/001714.html and there is additional info in Guilherme Polo's helpful replies.

Guilherme also supplied this minimal tcl sample of the behavior as well, which I don't understand enough to explain:

scale .s -command {puts}
pack .s

Thanks -

Dave Giesen
User Comments: fvogel added on 2016-03-07 21:03:16:
Merged in trunk and core-8-6-branch.

fvogel added on 2016-02-24 17:36:08:
Fix proposed in branch bug-2262543fff.

Several tests were added:

- scale-20.[4678]: non regression tests (these passed without the fix)

- scale-20.[1235]: pass with the fix

[email protected] added on 2008-11-11 21:00:20:
File Added - 300992: test_scalefire.py

Attachments: