-
-
Notifications
You must be signed in to change notification settings - Fork 30.7k
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
Teleport method for turtle class #88773
Comments
I use turtle pretty often in a teaching setting. It's extremely common that I'll define the following function at the top of my code: def teleport(x, y):
turtle.penup()
turtle.setpos(x, y)
turtle.pendown() Shouldn't this sort of method already exist within the turtle class? |
In my view, turtle is a great tool for exploring _polar_ coordinates. If you set emphasis to rectangular coordinates, there are many tools that are much better. Second, your function might be ok for you, but it is really not suitable for standard library. Probably you meant something like (a method) def teleport(self, *args):
restore = self.isdown()
self.penup()
self.setpos(*args)
if restore: self.pendown() |
What other Turtle implementations support the teleport command? |
Turtle is the most accessible and well-known drawing module for kids to use so teleporting makes more sense in the context of drawing random shapes or small pictures around the screen. I've seen the penup/goto/pendown combo so often that I figure it at least warrants a suggestion. Also my crappy function was mostly just meant as an outline, haha. |
Hello, my name is Liam, 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)? Also, you might see the same comment on 1-2 other issues, since we’ll likely be working on more than just one for our assignment. |
FWIW I agree that a Some existing other Turtle teleport references:
i'm reviewing the PR. |
Add a `teleport` method to `turtle` module turtle instances that acts a lot like `goto`, _but_ ensures the pen is up while warping to the new position to and can control shape filling behavior as part of the jump. Based on an educator user feature request. --------- Co-authored-by: Terry Jan Reedy <[email protected]> Co-authored-by: Hugo van Kemenade <[email protected]> Co-authored-by: Gregory P. Smith <[email protected]>
Thanks for your contribution Liam, merged. We don't often touch the turtle module as it's a bit of a leftover thing that we keep in the standard library because of its usefulness in educational settings, but this feature addition made sense. |
* main: (26 commits) pythongh-104028: Reduce object creation while calling callback function from gc (pythongh-104030) pythongh-104036: Fix direct invocation of test_typing (python#104037) pythongh-102213: Optimize the performance of `__getattr__` (pythonGH-103761) pythongh-103895: Improve how invalid `Exception.__notes__` are displayed (python#103897) Adjust expression from `==` to `!=` in alignment with the meaning of the paragraph. (pythonGH-104021) pythongh-88496: Fix IDLE test hang on macOS (python#104025) Improve int test coverage (python#104024) pythongh-88773: Added teleport method to Turtle library (python#103974) pythongh-104015: Fix direct invocation of `test_dataclasses` (python#104017) pythongh-104012: Ensure test_calendar.CalendarTestCase.test_deprecation_warning consistently passes (python#104014) pythongh-103977: compile re expressions in platform.py only if required (python#103981) pythongh-98003: Inline call frames for CALL_FUNCTION_EX (pythonGH-98004) Replace Netlify with Read the Docs build previews (python#103843) Update name in acknowledgements and add mailmap (python#103696) pythongh-82054: allow test runner to split test_asyncio to execute in parallel by sharding. (python#103927) Remove non-existing tools from Sundry skiplist (python#103991) pythongh-103793: Defer formatting task name (python#103767) pythongh-87092: change assembler to use instruction sequence instead of CFG (python#103933) pythongh-103636: issue warning for deprecated calendar constants (python#103833) Various small fixes to dis docs (python#103923) ...
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: