Page 189 - Programming With Python 3
P. 189
An Introduction to STEM Programming with Python — 2019-09-03a Page 176
Chapter 18 — Turtle Graphics
Chapter 18 — Turtle Graphics
Free
Introduction
In the early days of computing, a researcher named Grey Walter created a couple of simple robots that
he commanded by telling them to move forward, backward, and to turn left and right. This idea was
eBook
11
first used to teach children to draw simple graphics in the LOGO language. This concept has been
added to many languages over the years and was included in the early days of Python.
You can still think of the "turtle" as a little robot that drags a pen to draw lines as it moves. The turtle in
Python can also adjust the width of the pen, draw with over 16 million different colors, and do many
more things. This chapter will be a brief introduction to the turtle object. More can be found in the
Edition
python documentation.
Objectives
Upon completion of this chapter's exercises, you should be able to:
Please support this work at
Describe the turtle's coordinate system.
•
•
Draw polygons using basic turtle motion commands.
• Produce diagrams using colors, line width, and fill.
http://syw2l.org
• Change the turtle's position to an absolute position on the drawing surface.
• Display text on the turtle's drawing surface.
Prerequisites Free
The material in this chapter only depends on material from Chapters 1-8. With slight modifications to
the sample programs, only chapters 1-5 would be required.
eBook
Basic Turtle Motion
To use the turtle the first thing you must add to your program is the statement import turtle. This
loads the turtle module.
Edition
turtle Module
The turtle module allows you to draw images in a window. You will create turtles
11 https://social.technet.microsoft.com/wiki/contents/articles/29933.small-basic-the-history-of-the-logo-turtle.aspx
Copyright 2019 — James M. Reneau Ph.D. — http://www.syw2l.org — This work is licensed
under a Creative Commons Attribution-ShareAlike 4.0 International License.

