summaryrefslogtreecommitdiffstats
path: root/Demo
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1997-08-14 19:49:27 (GMT)
committerGuido van Rossum <guido@python.org>1997-08-14 19:49:27 (GMT)
commitdac444703d1b7022bf3c2307af9232775bf6f2d9 (patch)
treed03c3caf90ed3c33b78e099d251d2729f2d8f31f /Demo
parent20abb4e6b46873e19ff945763374af653f0f9192 (diff)
downloadcpython-dac444703d1b7022bf3c2307af9232775bf6f2d9.zip
cpython-dac444703d1b7022bf3c2307af9232775bf6f2d9.tar.gz
cpython-dac444703d1b7022bf3c2307af9232775bf6f2d9.tar.bz2
Add try-finally around main loop.
Diffstat (limited to 'Demo')
-rwxr-xr-xDemo/tkinter/guido/electrons.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/Demo/tkinter/guido/electrons.py b/Demo/tkinter/guido/electrons.py
index f3b8008..d764380 100755
--- a/Demo/tkinter/guido/electrons.py
+++ b/Demo/tkinter/guido/electrons.py
@@ -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