Guide to Python (University at Buffalo Version)
Chapter 9: Python Turtle Graphics
Using Python Turtle Graphics
Python provides a graphical drawing tool called Turtle graphics. To begin using Turtle, you must first import turtle
. Below are a few examples.
# first_turtle.py import turtle # Set the window size turtle.setup(300, 100) # Set the window title turtle.title('My First Turtle') # set the pen color turtle.pencolor("Dark Orange") # Move the turtle turtle.forward(50)

# first_turtle.py import turtle def main(): turtle.setup(200, 300) # Set the window title turtle.title('My First Turtle') # set the pen color turtle.pencolor("Dark Orange") # Move the turtle turtle.forward(50) for i in range(100, 110): turtle.left(90) turtle.forward(i) turtle.left(5) main() # keep window open turtle.Screen().exitonclick()
