The first argument is the internal variable name. You can use this name as an argument to the tkinter getvar
and setvar
methods. If you give your variable a name (eg: StringVar(name="foo")
) this will be the given name, otherwise it will be a name generated for you by tkinter (eg: PYVAR0
)
If the first argument represents a list variable (highly unlikely in tkinter), the second argument will be an index into that list. If it is a scalar variable, the second argument will be the empty string.
The third argument is the operation, useful if you are using the same method for reading, writing and/or deleting the variable. This argument tells you which operation triggered the callback. It will be one of “read”, “write”, or “unset”.
Tkinter is a python wrapper around a tcl/tk interpreter. The definitive documentation for variable traces can be found here: http://tcl.tk/man/tcl8.5/TclCmd/trace.htm#M14. Though, this only documents how the internal trace works, the tkinter wrapper sometimes massages the data.