You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
tkinter: The deprecated trace variable command was removed from Tk 9.0 - tkinter still uses it. #127802
The file tkinter/__init__.py contains the following code:
def trace_variable(self, mode, callback):
"""Define a trace callback for the variable.
MODE is one of "r", "w", "u" for read, write, undefine.
CALLBACK must be a function which is called when
the variable is read, written or undefined.
Return the name of the callback.
This deprecated method wraps a deprecated Tcl method that will
likely be removed in the future. Use trace_add() instead.
"""
# TODO: Add deprecation warning
trace = trace_variable
The deprecated Tcl method was removed from Tcl 9.0, before the deprecation warning was added in tkinter. The trace_variable() and trace() methods still exist in both the current tkinter/__init__.py and the replacement which was included in PR #124112. Calling those methods with Tk 9.0 raises a TclError.
changed the title [-]tkinter: deprecated Variable.trace_variable command is removed from Tk 9.0 [/-][+]tkinter: deprecated trace variable command was removed from Tk 9.0 - tkinter still uses it. [/+]on Dec 10, 2024
changed the title [-]tkinter: deprecated trace variable command was removed from Tk 9.0 - tkinter still uses it. [/-][+]tkinter: The deprecated trace variable command was removed from Tk 9.0 - tkinter still uses it. [/+]on Dec 10, 2024
The deprecated Tcl trace variable command was a short cut for trace add variable. My suggestion would be to add the deprecation warnings to the trace and trace_variable methods of the Variable class, and also make those commands call the trace_add method. That way code which uses the deprecated methods will still work.
Activity
[-]tkinter: deprecated Variable.trace_variable command is removed from Tk 9.0 [/-][+]tkinter: deprecated trace variable command was removed from Tk 9.0 - tkinter still uses it. [/+][-]tkinter: deprecated trace variable command was removed from Tk 9.0 - tkinter still uses it. [/-][+]tkinter: The deprecated trace variable command was removed from Tk 9.0 - tkinter still uses it. [/+]culler commentedon Dec 10, 2024
The deprecated Tcl
trace variablecommand was a short cut fortrace add variable. My suggestion would be to add the deprecation warnings to thetraceandtrace_variablemethods of theVariableclass, and also make those commands call thetrace_addmethod. That way code which uses the deprecated methods will still work.gh-127802: Schedule removal of legacy tkinter variable trace methods …
serhiy-storchaka commentedon Jun 25, 2026
They will be removed in 3.17.
[3.15] gh-127802: Schedule removal of legacy tkinter variable trace m…
terryjreedy commentedon Jun 25, 2026
idlelib/, turtledemo/, and turtle.py have no instances of
trace_variable.