tkinter change window class and create def to exit program code example Example: python tkinter close gui window from tkinter import * root=tk.Tk() root.destroy()