TheHoff TheHoff - 6 months ago 48
Python Question

tkinter, message box close program on click "ok"

How do I close the entire program once the user hits OK in the message box?

Here is the portion of the script that contains the button and command:

class Application(tk.Tk):
def create_options(self):

text = "Begin search", command=self.pop_up1
).place(x=465, y=285)

def pop_up1(self):
"""shows submitted box"""
tkMessageBox.showinfo(title="Finished", message="Query Submitted")


It depends what you mean by exit the entire program, you can close the window by using self.root.destroy() But depending on your implementation closing the window may not end your program but generally this is how you close a tkinter application. Just add it to the end of your button event.