diff options
author | Terry Jan Reedy <tjreedy@udel.edu> | 2014-06-22 05:18:54 (GMT) |
---|---|---|
committer | Terry Jan Reedy <tjreedy@udel.edu> | 2014-06-22 05:18:54 (GMT) |
commit | f51531e2578452a47914108a44bc74c15431a5b0 (patch) | |
tree | 2934d7292ace5015502daec8f37c6fa80fe41e91 /Lib/turtledemo/minimal_hanoi.py | |
parent | fabefc3c5b9e174e4eef2cb351a6ed8c81d721b0 (diff) | |
download | cpython-f51531e2578452a47914108a44bc74c15431a5b0.zip cpython-f51531e2578452a47914108a44bc74c15431a5b0.tar.gz cpython-f51531e2578452a47914108a44bc74c15431a5b0.tar.bz2 |
Issue #21823: Catch turtle.Terminator exceptions in turtledemo.
Add note to demohelp.txt about doing so.
Diffstat (limited to 'Lib/turtledemo/minimal_hanoi.py')
-rwxr-xr-x | Lib/turtledemo/minimal_hanoi.py | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/Lib/turtledemo/minimal_hanoi.py b/Lib/turtledemo/minimal_hanoi.py index cfb78dc..5e9c27b 100755 --- a/Lib/turtledemo/minimal_hanoi.py +++ b/Lib/turtledemo/minimal_hanoi.py @@ -18,6 +18,7 @@ stretched to rectangles by shapesize() --------------------------------------- """ from turtle import * +from turtle import Terminator # not in __all__ class Disc(Turtle): def __init__(self, n): @@ -50,9 +51,12 @@ def hanoi(n, from_, with_, to_): def play(): onkey(None,"space") clear() - hanoi(6, t1, t2, t3) - write("press STOP button to exit", - align="center", font=("Courier", 16, "bold")) + try: + hanoi(6, t1, t2, t3) + write("press STOP button to exit", + align="center", font=("Courier", 16, "bold")) + except Terminator: + pass # turtledemo user pressed STOP def main(): global t1, t2, t3 |