Tkinter validatecommand command mangles argument type? Tkinter validatecommand command mangles argument type? tkinter tkinter

Tkinter validatecommand command mangles argument type?


All works well except it appears the validatecommand changes the type of the Type object from Type to a string, which is not insurmountable but has made me curious what's going on.... However, I have still somewhat unsatisfied not knowing what happened with the first iteration - what am I doing wrong there?

You are doing nothing wrong, except trying to do something that by design tkinter doesn't support.

Tkinter is an object-oriented wrapper around an embedded Tcl interpreter. This embedded interpreter knows nothing about python objects, so python objects cannot be passed into or retrieved from the Tcl interpreter. When you pass a python function as an argument, tkinter must convert it to a string before it can be handled by the Tcl interpreter.

This is why you must register python functions with the Tcl interpreter. Tkinter will create an internal Tcl function that knows how to call your python function. The name of this function can then be used inside of the Tcl interpreter.