Create A Python Tkinter Window With No X (close) Button
I'm writing a 'wizard' type Python Tkinter GUI that collects information from the user and then performs several actions based on the user's entries: file copying, DB updates, etc
Solution 1:
self.dlgWin.overrideredirect(1)
will remove all of the buttons (make a borderless window). Is that what you're looking for?
Solution 2:
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 = ''defclose(self):
tkMessageBox.showwarning('Warning!',
'The pending action has not finished yet')
# ...
Post a Comment for "Create A Python Tkinter Window With No X (close) Button"