Keep getting a certain error with tkinter root.destroy Keep getting a certain error with tkinter root.destroy tkinter tkinter

Keep getting a certain error with tkinter root.destroy


        self.protocol("WM_DELETE_WINDOW", self.destroy())        GUI.protocol("WM_DELETE_WINDOW", GUI.destroy())

Generally, when you register callback methods, you need to omit the parentheses. Otherwise, the methods will be called immediately, and their return values will be registered instead. This means that destroy will be executed before Login executes, so self.t won't yet exist. Try:

        self.protocol("WM_DELETE_WINDOW", self.destroy)        GUI.protocol("WM_DELETE_WINDOW", GUI.destroy)