Skip to content

Instantly share code, notes, and snippets.

@makallio85
Created April 19, 2015 14:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save makallio85/b222326e4354b64cddfe to your computer and use it in GitHub Desktop.
Save makallio85/b222326e4354b64cddfe to your computer and use it in GitHub Desktop.
import tkinter as tk
import tkinter.messagebox
def message_and_close():
res = tk.messagebox.askquestion("Close program", "Are you sure?", icon='warning')
if res == "yes":
root.destroy()
root = tk.Tk()
button_frame = tk.Frame(root)
button_frame.pack()
reset_button = tk.Button(button_frame, text="Close", command=message_and_close)
reset_button.grid()
root.mainloop()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment