# Turtle Graphics

Use the turtle library to produce graphics and animations.

Grades 8+

- Web

Request Quote

for Middle School Curriculum

**Lesson Plan**

**Lesson: Turtle Graphics**

**Time: 40+ mins**

**Introduction**

In this lesson, students will learn to import and use the turtle library to create graphics, draw shapes, and create fun animations!**Vocabulary**

**Library:**A collection of predefined functions and values that can be imported into your program. Here are different ways that you can import the whole library:- Use the import keyword:

import*{libraryname}* - Import a particular function from the library:
*{library name} import {function name}*

- Use the import keyword:
**Turtle Library:**A library that defines a turtle object that can be used to draw shapes, lines, and colors.**Object:**A Python object contains variables, functions, and values that correspond to that particular version of the item. For example, each Turtle object that is created has the functions forward() and backward() that can be used by the object created. The turtle object also stores the color that has been most recently used so that the color can be used again.**Pixel:**A single dot on your computer screen. Computer screen resolutions are described in terms of how many pixels there are horizontally and vertically.

**Objectives**

Students will...- Import and use multiple programming libraries
- Use the turtle library like a pen to draw different shapes and images
- Change the color of the Turtle object

**Materials**

- Computers (1 per student) with student account access to Tynker.com

**Warm-Up** (*5 minutes*)

Lead a short discussion with your students:- As a class, discuss why programmers might apply graphics in their work. Is it for a game (e.g., hangman)? An artsy project?

**Activities** (*35 minutes*)

Facilitate as students complete the Turtle Graphics modules on their own:**1. Libraries (Tutorial)**

- Students will read a short document that explains libraries in Python.
- Emphasize to students that they can think of “math.sqrt” as “from the math library, get the sqrt function.”
- Optional: Ask students, “What is a library?” (a collection of predefined functions and values)
- Tell students to click the “Next” button (located at the bottom of the document) to move on to the next module.

**2. Import Syntax (Tutorial)**

- In this module, students will need to identify and correct errors in the given code.
- Note: Students are provided information on how to fix the syntax errors.

**3. Other Libraries (Tutorial)**

- Students will read a short document that introduces additional libraries such as the random library and the time library.
- Ask students to run the random library example several times. Why does the output change each time they run it?
- Optional: Ask students how the random library example is different from the time library example? How are they similar?
- Tell students to click the “Next” button to move on to the next module.

**4. Turtle Library (DIY)**

- Students will read a short document that explains the turtle library.
- Encourage students to slightly modify the code in the “moving” and “turning” examples. How do their changes affect the output?
- Are students struggling with the “Draw a polygon” DIY? Tell them to draw a square and use the code in the “turning” example as a reference.
- Are students struggling with the “Draw a star” DIY? Give a hint: Tell students to use “left(angle)” function, which turns the turtle left by the given angle. Also, tell students to use the “right(angle)” function, which turns the turtle right by the given angle.
- Check that students are adding different colors to their “Draw a star” DIY.
- Are students struggling with the “Chinese numbers” DIY? Tell them to use the code in the “pen control” example as a reference.
- Remind students to click the “submit project” button when they are done with their DIY projects—that way, you can check out their fabulous creations!
- Tell students to click the “Next” button to move on to the next module.

**5. Draw a Scene (DIY)**

- In this module, students will use the turtle library and apply their knowledge of turtle graphics to draw a creative scene.
- Optional: Review the given documentation with your students.
- Are students struggling with their syntax? Tell them to use the code in the previous module as a reference.
- Remind students to click the “submit project” button when they are done with their DIY project.
- Tell students to click the “Next” button to move on to the next module.

**6. Turtle Geometry (Tutorial)**

- Students will read a short document that explains how to apply math concepts to draw shapes.
- Encourage students to slightly modify the code in the provided examples. How do their changes affect the output?
- Are students struggling with the “Target practice” puzzle? Give a hint: Tell students to use the “pen up” and “pen down” features.

**7. Filling in Shapes (Tutorial)**

- Students will read a short document that explains how to apply the “begin_fill()” and “end_fill()” functions.
- Encourage students to slightly modify the code in the provided examples. Here are some ideas: change the color, change the distance, draw a square, draw an orange rectangle.

**8. Turtle Speed (Tutorial)**

- IIn this module, students are introduced to the “speed()” function, which tells a turtle how fast to move while creating graphics.Emphasize to students that the turtle moves fastest when the speed is set to 0. For example,

t = Turtle()

t.speed(0) - Encourage students to experiment with different speeds.

**9. Quiz**

- Unlike previous quizzes, this quiz requires students to apply concepts from this lesson to create a detailed scene. There are no multiple choice questions.
- Students are provided a suggestion of what to crate, but encourage them to display their knowledge by creating their own unique creations.
- Optional: As a class, brainstorm possible scenes your students would like to create.

**Discussion Questions/Follow-Up Activities** (*20 minutes*)

Lead a discussion with your students:- Who can describe one thing they learned today about turtle graphics?
- List different ways you can apply turtle graphics to a computer program.
- How are turtle graphics different from our previous text-based lessons? How are they similar?

**US Standards**

**CCSS-ELA:**SL.8.1, RI.9-10.3, RI.9-10.6, RI.11-12.3, RI.11-12.6, L.9-10.3, L.9-10.6, L.11-12.3, L.11-12.6**CCSS-Math:**HSN.Q.A.1, HSN.Q.A.2, HSN.Q.A.3, HSA.CED.A.1., HSA.CED.A.3, MP.1, MP.2, MP.4**CSTA:**2-AP-11, 2-AP-13, 2-AP-16, 2-AP-17, 3A-AP-17, 3B-AP-11, 3B-AP-22**CS CA:**6-8.AP.11, 6-8.AP.13, 6-8.AP.16, 6-8.AP.17, 9-12.AP.12, 9-12.AP.16**ISTE:**1.c, 1.d, 4.d, 5.c, 5.d, 6.b

###### Turtle Graphics

Python 201###### Lesson Includes

- 9 Activities
- 1 Completion Badge

###### Languages

Python

###### Experience

Advanced