When using Python Turtle
, how do you hide turtle icon(s)/pointer(s) in turtle graphics in Turtle
code so that it won't show when testing?
The documentation has a section on Visibility:
turtle.hideturtle()
turtle.ht()
Make the turtle invisible. It’s a good idea to do this while you’re in the middle of doing some complex drawing, because hiding the turtle speeds up the drawing observably.
>>> turtle.hideturtle()
Also, you can un-hide the turtle:
turtle.showturtle()
turtle.st()
Make the turtle visible.
>>> turtle.showturtle()
You can also query its visibilty:
turtle.isvisible()
ReturnTrue
if the Turtle is shown,False
if it’s hidden.
>>> turtle.hideturtle()
>>> turtle.isvisible()
False
>>> turtle.showturtle()
>>> turtle.isvisible()
True