RisingFlow
RisingFlow

Reputation: 11

Is it possible to NOT let the user close a Tkinter Window?

Is it poosible to hide the buttons for closing a window for the user? The user should not be able to close the window. Is this possible with python tkinter? Thanks!

Upvotes: 1

Views: 771

Answers (1)

Achintha Ihalage
Achintha Ihalage

Reputation: 2440

As described here, you can do it by disabling the (x) button with a simple pass.

import tkinter as tk

root=tk.Tk()

def disable_event():
    pass

root.protocol("WM_DELETE_WINDOW", disable_event)

root.mainloop()

Or you could remove the toolbar with root.overrideredirect(True).

Upvotes: 2

Related Questions