Our ValidatedSpinbox method seems adequate for most of our fields. But consider the Height fields for a moment. It would not make any sense for the Mini height value to be more than the Max height value, or for the Median height value not to be between them. Is there some way we can work this kind of interdependent behavior into our class?
We can! To do this, we'll rely on the tracing feature of Tkinter variables. A trace is essentially a hook into the .get() and .set() methods of variables that allows you to trigger any Python function or method when a variable is read or changed.
The syntax is as follows:
sv = tk.StringVar() sv.trace('w', some_function_or_method)