mirror of
https://github.com/python/cpython.git
synced 2025-11-01 18:51:43 +00:00
Issue #22115: Fixed tracing Tkinter variables:
* tracing in the "u" mode now works * trace_vdelete() with wrong mode no longer break tracing * trace_vinfo() now always returns a list of pairs of strings
This commit is contained in:
parent
e7614dd07d
commit
745a407df8
3 changed files with 66 additions and 8 deletions
|
|
@ -271,7 +271,7 @@ class Variable:
|
|||
|
||||
Return the name of the callback.
|
||||
"""
|
||||
f = CallWrapper(callback, None, self).__call__
|
||||
f = CallWrapper(callback, None, self._root).__call__
|
||||
cbname = repr(id(f))
|
||||
try:
|
||||
callback = callback.__func__
|
||||
|
|
@ -295,14 +295,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 [self._tk.split(x) for x in self._tk.splitlist(
|
||||
return [self._tk.splitlist(x) for x in self._tk.splitlist(
|
||||
self._tk.call("trace", "vinfo", self._name))]
|
||||
def __eq__(self, other):
|
||||
"""Comparison for equality (==).
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue