You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Space does not make turtledemo/sorting_animate.py Exit normally #125763
(Moved here from PR #125691 and revised): The normal way to stop within the demo framework is the red STOP button, and this works (but see below). The spacebar bit is for when one runs sorting_animate directly, as with f:\dev\3x>python -m turtledemo.sorting_animate. Spacebar does work then. Perhaps other demos should stop with spacebar when run directly. Maybe some do?
The 'but' above is that both STOP and spacebar raise Terminator when pressed while the animation is going, as opposed to when waiting for input (i, etc.). Both should be fixed.
When an example is run directly, if __name__ == "__main__": can run code limited to that mode. 'Space' as a replacement for STOP should only work when there is no STOP.
@rruuaanng Run turtledemo either from IDLE or console (py -m turtledemo on Windows).
I gave the 'solution', switching on __name__, above. However, since space-exit works the same as closing the window (and this include raising Terminator), and is unique, I think we can remove it. Problems with STOP (EDIT: and window closing) are not limited to this example, and cataloging and fixing them would be another issue.
Problems with STOP (EDIT: and window closing) are not limited to this example, and cataloging and fixing them would be another issue.
Do you mean that we need to create a separate issue that closing the window when a single case runtime might throw an error? (when running an animation)
I'm not quite sure what you mean in your comment, and if that's what I said, then I'd be happy to create a new one issue and try my best to solve it.
Activity
rruuaanng commentedon Oct 21, 2024
Can you explain it to me? I don't seem to understand it.
terryjreedy commentedon Oct 21, 2024
(Moved here from PR #125691 and revised): The normal way to stop within the demo framework is the red STOP button, and this works (but see below). The spacebar bit is for when one runs sorting_animate directly, as with
f:\dev\3x>python -m turtledemo.sorting_animate. Spacebar does work then. Perhaps other demos should stop with spacebar when run directly. Maybe some do?The 'but' above is that both STOP and spacebar raise Terminator when pressed while the animation is going, as opposed to when waiting for input (
i, etc.). Both should be fixed.When an example is run directly,
if __name__ == "__main__":can run code limited to that mode. 'Space' as a replacement for STOP should only work when there is no STOP.@rruuaanng Run turtledemo either from IDLE or console (
py -m turtledemoon Windows).Wulian233 commentedon Oct 24, 2024
Is it acceptable to remove the space-
exit? (which is used to run individual demo directly, but other demos do not have this function)
Or is there any other solution?
terryjreedy commentedon Oct 24, 2024
I gave the 'solution', switching on
__name__, above. However, since space-exit works the same as closing the window (and this include raising Terminator), and is unique, I think we can remove it. Problems with STOP (EDIT: and window closing) are not limited to this example, and cataloging and fixing them would be another issue.Xiaokang2022 commentedon Nov 8, 2024
@terryjreedy
I've created a PR to fix this. PTAL.
And about your comment:
Do you mean that we need to create a separate issue that closing the window when a single case runtime might throw an error? (when running an animation)
I'm not quite sure what you mean in your comment, and if that's what I said, then I'd be happy to create a new one issue and try my best to solve it.
gh-125763: Remove the broken spacebar quit binding in `turtledemo.sor…
pythongh-125763: Remove the broken spacebar quit binding in `turtlede…