The system tells the other widgets when the model changes

The tkinter library code will keep a track of which widgets are using which models and, whenever a model changes, tkinter will let the widgets know about it. So if we select the Seattle, WA radio button, it will update the model, and the other radio buttons that share the model will deselect themselves.

^Cambridge, UK

Well, that's not my value, so I'd better deselect myself.

There's a special name for the way this code works:

Model View Controller r

The model is the data stored.

The view is just a fancy name for the widget.

And the controller is the code in tkinter that lets all of the views know when the model has changed.

So much for the MVC theory. Time to fix the code.

tkinter models

Was this article helpful?

0 0

Post a comment