Issue #20067: Tkinter variables now work when wantobjects is false.

This commit is contained in:
Serhiy Storchaka 2013-12-26 20:05:53 +02:00
parent dfd21d3538
commit 5e11655156
2 changed files with 6 additions and 2 deletions

View 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

View File

@ -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.