]> granicus.if.org Git - python/commitdiff
Issue #20067: Tkinter variables now work when wantobjects is false.
authorSerhiy Storchaka <storchaka@gmail.com>
Thu, 26 Dec 2013 18:05:53 +0000 (20:05 +0200)
committerSerhiy Storchaka <storchaka@gmail.com>
Thu, 26 Dec 2013 18:05:53 +0000 (20:05 +0200)
Lib/lib-tk/Tkinter.py
Misc/NEWS

index 6a91ba9be9254367e229c49e02c87e2579a55821..700f6bb0b1f8a947751450422f523c7e8449aedc 100644 (file)
@@ -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
index 12106579e0efc87db872bc85a0dcaab534454ea9..914f6f66f2db6b19387c59d0e6c589bd947c3a48 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -27,6 +27,8 @@ Core and Builtins
 Library
 -------
 
+- Issue #20067: Tkinter variables now work when wantobjects is false.
+
 - Issue #19020: Tkinter now uses splitlist() instead of split() in configure
   methods.