Search⌘ K

Draw with Python (Turtle Power)

Explore how to use Python's built-in turtle module to create drawings by moving a pen across the screen. Understand basic commands to control movement, apply loops for repeated patterns, and customize colors and line styles to enhance your graphics.

Let’s do something fun and creative—use Python to draw pictures.

We’ll use a built-in Python module called turtle to control a pen on the screen.

Introducing the turtle

Try this:

import turtle

pen = turtle.Turtle()
pen.forward(100)
Creating a turtle and drawing a line 100 pixels long
    ...