Interactively validating Entry widget content in tkinter

The correct answer is, use the validatecommand attribute of the widget. Unfortunately this feature is severely under-documented in the Tkinter world, though it is quite sufficiently documented in the Tk world. Even though it’s not documented well, it has everything you need to do validation without resorting to bindings or tracing variables, or modifying the … Read more

Best way to structure a tkinter application?

I advocate an object oriented approach. This is the template that I start out with: # Use Tkinter for python 2, tkinter for python 3 import tkinter as tk class MainApplication(tk.Frame): def __init__(self, parent, *args, **kwargs): tk.Frame.__init__(self, parent, *args, **kwargs) self.parent = parent <create the rest of your GUI here> if __name__ == “__main__”: root … Read more