New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Catch turtle.Terminator exceptions in turtledemo #66022
Comments
When a turtle update operation cannot finish because the underlying canvas has been cleared (when the STOP button is pushed), turtle.Terminator is raised. When turtledemo runs the main function of a demo, it catches any Termininator raised before main returns. However, special demos leave an event loop running after main returns. If the demo is free running, as with clock and minimal_hanoi, clicking STOP causes such exceptions. (This is not be a problem with paint as updates only happen in response to mouse events on the canvas and complete before a user could move the mouse to the STOP button.) This is the clock trackback, with common file prefix removed: The hanoi traceback starts differently: These exceptions and tracebacks do not stop the master demo window, but are printed to the console (python -m turtledemo) or Idle Shell (open in editor, run). They are ugly, might unnecessarily alarm a naive user, or falsely teach that tracebacks are to be ignored. In the patch to clock.tick, I put try: at the top, to be safe, although just before the update of the second hand might be good enough. |
New changeset a43d03cdf38b by Terry Jan Reedy in branch '2.7': New changeset 1ae2382417dc by Terry Jan Reedy in branch '3.4': |
In 2.7, the exception in tick occurred at tracer(False), so I moved try: up in all patches. |
Since hanoi do not have user interaction, once started, it does not need to be 'special'. Like planets_and_moon, it could run until done and then return 'Done'. |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: