Tk Library Source Code

View Ticket
Login
Ticket UUID: cd399b24dbb91b47b0d080cbe8d9a74948c7cba3
Title: ttk::spinbox command is invoked without stop
Type: Bug Version: Tcl/Tk 8.6.4
Submitter: badchicken Created on: 2017-03-27 13:54:44
Subsystem: widget Assigned To: nobody
Priority: 5 Medium Severity: Important
Status: Closed Last Modified: 2026-11-21 09:43:38
Resolution: Not Applicable Here Closed By: serhiy.storchaka
    Closed on: 2026-11-21 00:00:00
Description:

I have an strange behavior that it invokes the command without stop. I write the next code in the wish8.6 console:

 ttk::spinbox .sb -from 0 -to 10000 -command [list ::danitest]
 grid .sb
 proc ::danitest {} {
    puts "inside"
    tkwait variable ::danivar
    puts "outside"
 }
Then, I do a single click on any arrow. The command is invoked and I can read the message "inside". Now, the process is waiting to the change of my variable danivar. In this momment, I write in the console the next code:
 set ::danivar 1

and when I press return I see that the message "outside" is shown, and some milliseconds later, the event is recalled (and I can read again the message "inside"). This behaviour doesn't stops.

I don't know if it is my fault or there is an error. I have the same behaviour if I use the command error instead of tkwait.

User Comments: serhiy.storchaka added on 2026-11-21 09:43:38:

This is about ttk::spinbox in Tk, not tklib.

The tkwait case was real in Tk 8.6.4: the auto-repeat timer was started only after the command, so the button release during the tkwait came before the timer and did not cancel it. It was fixed in Tk in fb9a363237 (2022), and the command now runs once.

The case of a command which raises an error still repeats endlessly: the error dialog takes the grab, so the button release never reaches the spinbox. This is now Tk ticket 1842c9eb67, with a proposed fix.