import tkinter as tk import gui if __name__ == '__main__': root = tk.Tk() app = gui.Application(master=root) app.mainloop() try: root.destroy() except tk.TclError: pass