Commit 7af55243 authored by Serhiy Storchaka's avatar Serhiy Storchaka

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

parent 082a606c
...@@ -223,11 +223,13 @@ class Variable: ...@@ -223,11 +223,13 @@ class Variable:
_varnum += 1 _varnum += 1
if value is not None: if value is not None:
self.set(value) 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) self.set(self._default)
def __del__(self): def __del__(self):
"""Unset the variable in Tcl.""" """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): def __str__(self):
"""Return the name of the variable in Tcl.""" """Return the name of the variable in Tcl."""
return self._name return self._name
......
...@@ -27,6 +27,8 @@ Core and Builtins ...@@ -27,6 +27,8 @@ Core and Builtins
Library Library
------- -------
- Issue #20067: Tkinter variables now work when wantobjects is false.
- Issue #19020: Tkinter now uses splitlist() instead of split() in configure - Issue #19020: Tkinter now uses splitlist() instead of split() in configure
methods. methods.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment