code:
import tkinter as tk root = tk.Tk() root.geometry('200x200') # create a function to close the window def close_window(): root.destroy() close_bt = tk.Button(root, text = 'close', command = close_window) close_bt.pack() # create a function to disable close bt of the main window def disable_close_bt(): return root.protocol('WM_DELETE_WINDOW', disable_close_bt) root.mainloop()
Top comments (0)