Skip to content
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

Removing/destroying a turtle from a screen #93642

Open
karelhusa opened this issue Jun 9, 2022 · 0 comments
Open

Removing/destroying a turtle from a screen #93642

karelhusa opened this issue Jun 9, 2022 · 0 comments
Labels
type-feature

Comments

@karelhusa
Copy link

@karelhusa karelhusa commented Jun 9, 2022

Feature or enhancement
Add new TurtleScreen method to remove a specific turtle.
screen.remove(turtle)

The turtle will be removed and no longer associated with the screen. Finally the object can be collected by the garbace collector.

Pitch

Turtle is a great way to learn Python and we use it with students to make simple games. In some games we create many turtles.

When I create a new turtle with:
my_turtle = turtle.Turtle()

I can:

  • hide it with turtle.hideturtle()
  • clear the drawing with turtle.clear()

However, I have no simple way to remove (destroy) the turtle.

It's a good programming practice to free the object that is no longer being used, so I would like to remove the unused turtles. Otherwise the turtles are piling up.

Previous discussion
This missing feature is discussed at multiple places on the web, e.g.:
https://stackoverflow.com/questions/43972351/how-to-fully-delete-a-turtle
There is no simple solution so far, rather complicated.

And since "Simple is better than complex. Complex is better than complicated." I propose this enhancement.

@karelhusa karelhusa added the type-feature label Jun 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type-feature
Projects
None yet
Development

No branches or pull requests

1 participant