Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to hide a turtle icon/pointer in Python

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?

like image 379
Bryant Avatar asked Sep 27 '15 04:09

Bryant


People also ask

How can I hide my turtle logo?

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.

How do you make a turtle pen invisible?

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.

How do you get rid of turtle shape?

clear() This function is used to delete the turtle's drawings from the screen.


1 Answers

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()
Return True if the Turtle is shown, False if it’s hidden.

>>> turtle.hideturtle()
>>> turtle.isvisible()
False
>>> turtle.showturtle()
>>> turtle.isvisible()
True
like image 130
Peter Wood Avatar answered Oct 24 '22 20:10

Peter Wood