Skip to content
Related Articles

Related Articles

Improve Article

turtle.shape() function in Python

  • Last Updated : 20 Jul, 2020
Geek Week

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.

default : ‘classic’

‘arrow’

‘turtle’

‘circle’

‘square’

‘triangle’



Example:

Python3




# 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:

 Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.  

To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course. And to begin with your Machine Learning Journey, join the Machine Learning – Basic Level Course




My Personal Notes arrow_drop_up
Recommended Articles
Page :