python window close method code example
Example: close window tkinter
try:
import Tkinter as tk
except:
import tkinter as tk
root = tk.Tk()
root.geometry("100x50")
def close_window():
root.destroy()
button = tk.Button(text = "Click and Quit", command = close_window)
button.pack()
root.mainloop()