How to Create Turtle Shapes in Python

Preet Sanghavi Feb 02, 2024
How to Create Turtle Shapes in Python

This tutorial explains how to work with the turtle library and create different shapes in Python. We start by first importing the turtle library.

Use the turtle.shape() Function to Create Shapes in Python

Importing turtle:

import turtle

Turtle library needs a Python version installed, supporting the Tkinter library since it uses Tk for the underlying graphics.

We will work here with the turtle.shape() function to set the turtle shape to a shape with the given name. The shape name given must exist in the Turtle Screen’s shape library.

We can choose between circle, square, turtle, arrow, triangle and classic.

Let us now start working with the turtle.shape() function.

turtle.forward(70)

turtle.shape("circle")
turtle.right(60)
turtle.forward(100)

turtle.shape("arrow")
turtle.right(60)
turtle.forward(100)

In the above code, we first create the default shape. Then the circle and arrow shapes, respectively.

Let’s see the above code’s output below.

Create Turtle Shapes in Python 1

Create Turtle Shapes in Python 2

We have successfully created the turtle shapes using the code above. Hence we can successfully create shapes using the above method.

Preet Sanghavi avatar Preet Sanghavi avatar

Preet writes his thoughts about programming in a simplified manner to help others learn better. With thorough research, his articles offer descriptive and easy to understand solutions.

LinkedIn GitHub

Related Article - Python Turtle