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?
hideturtle or ht means hide the turtle, so you can admire your drawing. showturtle or st means show the turtle, so you can continue your drawing.
hideturtle() This method is used to make the turtle invisible. It's a good idea to do this while you're in the middle of a complicated drawing because hiding the turtle speeds up the drawing observably. This method does not require any argument.
clear() This function is used to delete the turtle's drawings from the screen.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With