Skip to content

Turtle context managers for fill, poly and tracer #126349

Closed

Description

@yngvem

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

Activity

  1. added
    stdlibStandard Library Python modules in the Lib/ directory
    on Nov 8, 2024
  2. added a commit that references this issue on Jan 18, 2025
  3. erlend-aasland commented on Jan 18, 2025

    @erlend-aasland
    Contributor

    Thanks for suggesting and implementing this!

  4. hugovk commented on Jan 19, 2025

    @hugovk
    Member

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

  5. reopened this on Jan 19, 2025
  6. added a commit that references this issue on Jan 20, 2025
  7. added a commit that references this issue on Jan 21, 2025
  8. added a commit that references this issue on Jan 21, 2025
  9. hugovk commented on Feb 27, 2025

    @hugovk
    Member

    Refleak fixed in #129079, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    stdlibStandard Library Python modules in the Lib/ directorytype-featureA feature request or enhancement

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions