]> granicus.if.org Git - python/commitdiff
Add try-finally around main loop.
authorGuido van Rossum <guido@python.org>
Thu, 14 Aug 1997 19:49:27 +0000 (19:49 +0000)
committerGuido van Rossum <guido@python.org>
Thu, 14 Aug 1997 19:49:27 +0000 (19:49 +0000)
Demo/tkinter/guido/electrons.py

index f3b80081d0ebd1cf3920beead427dde7a6982908..d7643804caab006f634ac5e20ce5acb801d6f59c 100755 (executable)
@@ -52,8 +52,11 @@ class Electrons:
 
        # Run -- never returns
        def run(self):
-               while 1:
-                       self.random_move(self.n)
+               try:
+                       while 1:
+                               self.random_move(self.n)
+               finally:
+                       self.tk.destroy()
 
 
 # Main program