-
-
Notifications
You must be signed in to change notification settings - Fork 31.8k
Turtle Circle Speed 0 #65276
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
Comments
A circle is supposed to draw upon a click event, but if speed is set to 0 it appears that the circle fails to draw and all existing lines are erased. A screenshot of the behavior with radius = 20 can be seen here: http://i.imgur.com/y7z87AN.png This state can be replicated by completing an entire game worth of clicks. Someone replying to my StackOverflow question noted that if the radius of the circle is increased (radius = 200 for example) it becomes apparent that the circle is actually drawing, but the existing lines are still erased. A screenshot of the behavior with radius = 200 can be seen here: http://i.imgur.com/gYeOlnT.png This state can be replicated by clicking bottom middle, middle middle, then bottom right, in that order. You will note that only lines on the clickable Tic-Tac-Toe board are erased, and lines outside of it remain intact. Load my code and click the Tic-Tac-Toe board to reproduce the bug. Please use my exact code, as you WILL fail to reproduce the bug by simply importing turtle and drawing a circle. To change the circle radius in my code locate the radius variable assignment in the draw_circle() function. It is located on line 77 of the code. Source code in file aoeu.py above. |
This seems to be caused by a bug in TurtleScreen.update/turtle._drawturtle. When the speed is set to zero, the tracer method is used to regulate drawing circles, and when called with a positive integer, tracer calls update. Update iterates over the list of existing turtle objects and then updates them and calls _drawturtle on them, then redraws them, but doesn't draw lines or stamps so they'll get drawn over by shapes and images. I attached a snippet (update_example.py above) that shows the bug happening when you call update directly, if you switch the last line and use tracer instead the same thing happens. I think the way to fix it is to add stamps and lines to _drawturtle so I'm going to work on a patch that uses that approach. |
The next step on this issue would be to test if this behavior is still present in Python 3.6 and 3.7 and report the result of your test here. |
Hello, my name is Elizabeth, and I’m part of a student software engineer group of 4 at Carnegie Mellon. We’ve been tasked with contributing to an open source project, and this issue seems like a great first start. Would you mind assigning this to me (my group)? |
Hi @elzlee, yes you and your group may start working on this issue. Please check out of DevGuide (https://devguide.python.org) which is our contributing guide to understand how to contribute to CPython. We don't (and unable to) "assign" issues to non-maintainers, so you can just go ahead and work on this. It looks like the next steps here are to re-run the sample code provided and see if the issue still exists in Python 3.12.. if it is no longer an issue, then let us know so the issue can be closed. and you may want to read Ingrid's comment above which may provide clues on where the bug exists and perhaps how to fix it. Let us know if you have further questions. Keep us updated on your investigation of this issue. |
Hi @elzlee, if you have any questions regarding CPython's contribution process, or you are evaluating what areas to contribute towards, you can email me at kenjin@python.org. I'll be more than happy to answer any queries your team may have. For some context, I work on the CPython typing module, the C parts of CPython (specifically the interpreter), and CPython performance. So if your team is interested in contributing to any of those areas, I would be happy to help. |
I verified that Garrett's aoeu.py with line 12 setting speed to 0 commented out works (except for not detecting a winner). The default speed is 3. Uncommenting the line and clicking causes the erasure he mentions. Ingrid's short example with the last two lines commented out shows colored t1 square with stamped t2, line drawn by t2, and t2 in final position. Uncommenting either of the last two lines erases the stamp and line. What puzzles me is that the speed in not set to 0 but is left at 3. And what if different turtles have different speeds? Stopping here for now. |
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:
Linked PRs
The text was updated successfully, but these errors were encountered: