[Python-checkins] cpython (2.7): Issue #20067: Tkinter variables now work when wantobjects is false.

serhiy.storchaka python-checkins at python.org
Thu Dec 26 19:09:02 CET 2013


http://hg.python.org/cpython/rev/b13c15a9ae54
changeset:   88196:b13c15a9ae54
branch:      2.7
parent:      88191:3598805d7636
user:        Serhiy Storchaka <storchaka at gmail.com>
date:        Thu Dec 26 20:05:53 2013 +0200
summary:
  Issue #20067: Tkinter variables now work when wantobjects is false.

files:
  Lib/lib-tk/Tkinter.py |  6 ++++--
  Misc/NEWS             |  2 ++
  2 files changed, 6 insertions(+), 2 deletions(-)


diff --git a/Lib/lib-tk/Tkinter.py b/Lib/lib-tk/Tkinter.py
--- a/Lib/lib-tk/Tkinter.py
+++ b/Lib/lib-tk/Tkinter.py
@@ -223,11 +223,13 @@
             _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
diff --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -27,6 +27,8 @@
 Library
 -------
 
+- Issue #20067: Tkinter variables now work when wantobjects is false.
+
 - Issue #19020: Tkinter now uses splitlist() instead of split() in configure
   methods.
 

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list