Open In App

turtle.isvisible() function in Python

The turtle module provides turtle graphics primitives, in both object-oriented and procedure-oriented ways. Because it uses Tkinter for the underlying graphics, it needs a version of Python installed with Tk support.

turtle.isvisible()

The turtle.isvisible() method is used to return True if the Turtle is shown, False if it’s hidden. This method does not require any argument.



Syntax :

turtle.isvisible()

Below is the implementation of above method for better understandings :



Example 1:




# import package
import turtle
  
  
# check turtle visibility
print(turtle.isvisible())
  
# motion
turtle.forward(100)
turtle.right(90)
  
# hide the turtle
turtle.ht()
  
# motion
turtle.forward(100)
  
# check turtle visibility
print(turtle.isvisible())
  
# motion
turtle.right(90)
turtle.forward(100)
  
# show the turtle
turtle.st()
  
# check turtle visibility
print(turtle.isvisible())

Output :

True
False
True
Article Tags :