summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
Diffstat (limited to 'Lib')
-rw-r--r--Lib/lib-tk/Tkinter.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/Lib/lib-tk/Tkinter.py b/Lib/lib-tk/Tkinter.py
index 6a91ba9..700f6bb 100644
--- a/Lib/lib-tk/Tkinter.py
+++ b/Lib/lib-tk/Tkinter.py
@@ -223,11 +223,13 @@ class Variable:
_varnum += 1
if value is not None:
self.set(value)
- elif not self._tk.call("info", "exists", self._name):
+ elif not self._tk.getboolean(self._tk.call("info", "exists", self._name)):
self.set(self._default)
def __del__(self):
"""Unset the variable in Tcl."""
- self._tk.globalunsetvar(self._name)
+ if (self._tk is not None and
+ self._tk.getboolean(self._tk.call("info", "exists", self._name))):
+ self._tk.globalunsetvar(self._name)
def __str__(self):
"""Return the name of the variable in Tcl."""
return self._name