[Python-checkins] r43555 - python/trunk/Lib/lib-tk/Tkinter.py

georg.brandl python-checkins at python.org
Sun Apr 2 23:09:52 CEST 2006


Author: georg.brandl
Date: Sun Apr  2 23:09:51 2006
New Revision: 43555

Modified:
   python/trunk/Lib/lib-tk/Tkinter.py
Log:
Remove "disgusting hack" in favour of closure (patch #1462235)



Modified: python/trunk/Lib/lib-tk/Tkinter.py
==============================================================================
--- python/trunk/Lib/lib-tk/Tkinter.py	(original)
+++ python/trunk/Lib/lib-tk/Tkinter.py	Sun Apr  2 23:09:51 2006
@@ -449,18 +449,15 @@
             # 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


More information about the Python-checkins mailing list