Draw with Python (Turtle Power!)
Learn how to use turtle to draw shapes and patterns.
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
Line 3:
pen = turtle.Turtle()
brings a turtle onto the screen that you can control. We are giving it a name:pen
. You can call it anything you like. From now on, ...