summaryrefslogtreecommitdiffstats
path: root/Lib/lib-tk/Tkinter.py
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2016-06-26 14:41:14 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2016-06-26 14:41:14 (GMT)
commit199b7d5662fe3803733e2067e8fad523d74b1988 (patch)
tree74957b401efb0a0f4439e814ad2057e2afae5f8b /Lib/lib-tk/Tkinter.py
parent0c67a5f3bf021beab319969c539125fe89d1ed6c (diff)
downloadcpython-199b7d5662fe3803733e2067e8fad523d74b1988.zip
cpython-199b7d5662fe3803733e2067e8fad523d74b1988.tar.gz
cpython-199b7d5662fe3803733e2067e8fad523d74b1988.tar.bz2
Issue #22115: Fixed tracing Tkinter variables.
* trace_vdelete() with wrong mode no longer break tracing * trace_vinfo() now always returns a list of pairs of strings
Diffstat (limited to 'Lib/lib-tk/Tkinter.py')
-rw-r--r--Lib/lib-tk/Tkinter.py17
1 files changed, 11 insertions, 6 deletions
diff --git a/Lib/lib-tk/Tkinter.py b/Lib/lib-tk/Tkinter.py
index e825afa..64e9924 100644
--- a/Lib/lib-tk/Tkinter.py
+++ b/Lib/lib-tk/Tkinter.py
@@ -302,14 +302,19 @@ class Variable:
CBNAME is the name of the callback returned from trace_variable or trace.
"""
self._tk.call("trace", "vdelete", self._name, mode, cbname)
- self._tk.deletecommand(cbname)
- try:
- self._tclCommands.remove(cbname)
- except ValueError:
- pass
+ cbname = self._tk.splitlist(cbname)[0]
+ for m, ca in self.trace_vinfo():
+ if self._tk.splitlist(ca)[0] == cbname:
+ break
+ else:
+ self._tk.deletecommand(cbname)
+ try:
+ self._tclCommands.remove(cbname)
+ except ValueError:
+ pass
def trace_vinfo(self):
"""Return all trace callback information."""
- return map(self._tk.split, self._tk.splitlist(
+ return map(self._tk.splitlist, self._tk.splitlist(
self._tk.call("trace", "vinfo", self._name)))
def __eq__(self, other):
"""Comparison for equality (==).