Create a python tkinter window with no X (close) button Create a python tkinter window with no X (close) button tkinter tkinter

Create a python tkinter window with no X (close) button


self.dlgWin.overrideredirect(1) will remove all of the buttons (make a borderless window). Is that what you're looking for?


As far as I know, window control buttons are implemented by the window manager, so I think it is not possible to just remove one of them with Tkinter (I am not 100% sure though). The common solution for this problem is to set a callback to the protocol WM_DELETE_WINDOW and use it to control the behaviour of the window:

class _cdlgWin():    def __init__(self,parent,*args):        self.parent = parent        self.dlgWin = tk.Toplevel()        self.dlgWin.protocol('WM_DELETE_WINDOW', self.close)        self.userResponse = ''    def close(self):        tkMessageBox.showwarning('Warning!',                                 'The pending action has not finished yet')    # ...