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.
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:
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.
The text was updated successfully, but these errors were encountered: