code: def on_exit(self):
          
          answer = messagebox.askyesnocancel("Exit", "Do you want to save as you quit the application?")
          if answer:
              self.save()
              self.quit()
              self.destroy()
          elif answer is None:
              pass # the cancel action
          else:
              self.quit()
              self.destroy()
docs: When you click to exit, this function is called, prompts whether to save