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.shape()
This function is used to set the turtle shape to shape with a given name or, if the name is not given, return the name of the current shape.
Syntax:
turtle.shape(name=None)
Shape with name must exist in the Turtle Screen’s shape dictionary. Initially, there are the following polygon shapes: “arrow”, “turtle”, “circle”, “square”, “triangle”, “classic”. These images are shown below.
Example:
# import package import turtle
# for default shape turtle.forward( 100 )
# for circle shape turtle.shape( "circle" )
turtle.right( 60 )
turtle.forward( 100 )
# for triangle shape turtle.shape( "triangle" )
turtle.right( 60 )
turtle.forward( 100 )
# for square shape turtle.shape( "square" )
turtle.right( 60 )
turtle.forward( 100 )
# for arrow shape turtle.shape( "arrow" )
turtle.right( 60 )
turtle.forward( 100 )
# for turtle shape turtle.shape( "turtle" )
turtle.right( 60 )
turtle.forward( 100 )
|
Output: