def wanna_quit(): if messagebox.askyesno("Quit", "Do you really want to quit?"): # the user clicked yes, let's close the window root.destroy()