def on_close():
#custom close options, here's one example:
close = messagebox.askokcancel("Close", "Would you like to close the program?")
if close:
root.destroy()
root.protocol("WM_DELETE_WINDOW", on_close)
We use cookies to ensure that we give you the best experience on our website. If you continue to use this site we will assume that you are happy with it.OkRead more