diff options
author | Georg Brandl <georg@python.org> | 2006-04-02 21:09:51 (GMT) |
---|---|---|
committer | Georg Brandl <georg@python.org> | 2006-04-02 21:09:51 (GMT) |
commit | 4696ffbf0935519eb457ea6a786f22631a63ffda (patch) | |
tree | 9b1acdf4cee33b38d9bcd38ddf8a0306598583c1 /Lib/lib-tk | |
parent | c5ffd9191189b00c9801f126604bb0b575e19e16 (diff) | |
download | cpython-4696ffbf0935519eb457ea6a786f22631a63ffda.zip cpython-4696ffbf0935519eb457ea6a786f22631a63ffda.tar.gz cpython-4696ffbf0935519eb457ea6a786f22631a63ffda.tar.bz2 |
Remove "disgusting hack" in favour of closure (patch #1462235)
Diffstat (limited to 'Lib/lib-tk')
-rw-r--r-- | Lib/lib-tk/Tkinter.py | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/Lib/lib-tk/Tkinter.py b/Lib/lib-tk/Tkinter.py index 37ddd3a..5bd7aa9 100644 --- a/Lib/lib-tk/Tkinter.py +++ b/Lib/lib-tk/Tkinter.py @@ -449,18 +449,15 @@ class Misc: # I'd rather use time.sleep(ms*0.001) self.tk.call('after', ms) else: - # XXX Disgusting hack to clean up after calling func - tmp = [] - def callit(func=func, args=args, self=self, tmp=tmp): + def callit(): try: func(*args) finally: try: - self.deletecommand(tmp[0]) + self.deletecommand(name) except TclError: pass name = self._register(callit) - tmp.append(name) return self.tk.call('after', ms, name) def after_idle(self, func, *args): """Call FUNC once if the Tcl main loop has no event to |