diff --git a/Lib/tkinter/__init__.py b/Lib/tkinter/__init__.py index 3bfeb7a017..ee17f6a41c 100644 --- a/Lib/tkinter/__init__.py +++ b/Lib/tkinter/__init__.py @@ -2293,8 +2293,9 @@ def _loadtk(self): self.tk.createcommand('exit', _exit) self._tclCommands.append('tkerror') self._tclCommands.append('exit') - if _support_default_root and not _default_root: - _default_root = self + if _support_default_root: + if _default_root: + _default_root = self self.protocol("WM_DELETE_WINDOW", self.destroy) def destroy(self): @@ -2304,8 +2305,9 @@ def destroy(self): self.tk.call('destroy', self._w) Misc.destroy(self) global _default_root - if _support_default_root and _default_root is self: - _default_root = None + if _support_default_root: + if _default_root is self: + _default_root = None def readprofile(self, baseName, className): """Internal function. It reads BASENAME.tcl and CLASSNAME.tcl into