import tkinter as tk
root = tk.Tk()
root.geometry('200x200')
def close_window():
root.destroy()
close_bt = tk.Button(root, text = 'close', command = close_window)
close_bt.pack()
def disable_close_bt():
return
root.protocol('WM_DELETE_WINDOW', disable_close_bt)
root.mainloop()
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter