Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Turtle context managers for fill, poly and tracer #126349

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

Closed
yngvem opened this issue Nov 3, 2024 · 3 comments
Closed

Turtle context managers for fill, poly and tracer #126349

yngvem opened this issue Nov 3, 2024 · 3 comments
Labels
stdlib Python modules in the Lib dir type-feature A feature request or enhancement

Comments

@yngvem
Copy link
Contributor

yngvem commented Nov 3, 2024

Feature or enhancement

Proposal:

When I taught Python with Turtle, I always had to find other examples when I got to context managers. This is a shame, as there are several places in the Turtle module where context managers make sense. The most obvious places (in my opinion) are:

  • turtle.begin_fill() / turtle.end_fill()
  • turtle.begin_poly() / turtle.end_poly()
  • turtle.tracer(0) / turtle.tracer(1) (disable animations)

@MarieRoald and I plan to submit a PR about this shortly

Has this already been discussed elsewhere?

I have already discussed this feature proposal on Discourse

Links to previous discussion of this feature:

https://discuss.python.org/t/improving-the-turtle-library/61840

Linked PRs

@yngvem yngvem added the type-feature A feature request or enhancement label Nov 3, 2024
@picnixz picnixz added the stdlib Python modules in the Lib dir label Nov 8, 2024
erlend-aasland added a commit that referenced this issue Jan 18, 2025
… turtle (#126350)

Co-authored-by: Marie Roald <[email protected]>
Co-authored-by: Yngve Mardal Moe <[email protected]>
Co-authored-by: Hugo van Kemenade <[email protected]>
Co-authored-by: Daniel Hollas <[email protected]>
Co-authored-by: Bénédikt Tran <[email protected]>
Co-authored-by: Erlend E. Aasland <[email protected]>
@erlend-aasland
Copy link
Contributor

Thanks for suggesting and implementing this!

@hugovk
Copy link
Member

hugovk commented Jan 19, 2025

Let's re-open to handle the reference leak: #126350 (comment).

@hugovk hugovk reopened this Jan 19, 2025
srinivasreddy pushed a commit to srinivasreddy/cpython that referenced this issue Jan 21, 2025
…ers to turtle (python#126350)

Co-authored-by: Marie Roald <[email protected]>
Co-authored-by: Yngve Mardal Moe <[email protected]>
Co-authored-by: Hugo van Kemenade <[email protected]>
Co-authored-by: Daniel Hollas <[email protected]>
Co-authored-by: Bénédikt Tran <[email protected]>
Co-authored-by: Erlend E. Aasland <[email protected]>
@hugovk
Copy link
Member

hugovk commented Feb 27, 2025

Refleak fixed in #129079, thanks!

@hugovk hugovk closed this as completed Feb 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stdlib Python modules in the Lib dir type-feature A feature request or enhancement
Projects
Development

No branches or pull requests

4 participants