Tech Lesson 11-5:  Drawing Shapes with Python and Turtle - Basic Python Programming with JES

CSTA Level I Standard 4: (3rd to 5th) Use general purpose productivity tools and peripherals to support personal productivity, remediate skill deficits, and facilitate learning throughout the curriculum.
CSTA Level I Standard 5: (3rd to 5th) Use technology tools for individual and collaborative writing, communication, and publishing activities to create presentations, and publishing activities to create presentations for audiences inside and outside the classroom.

Basic Skills:

M4M2: Students will understand the concept of angle and how to measure angles.
M4G1: Students will define and identify the characteristics of geometric figures through examination and construction.
M4P5:  Students will represent mathematics in multiple ways.
M5A1: Students will represent and interpret the relationships between quantities algebraically.
M5G1: Students will understand congruence of geometric figures and the correspondence of their vertices, sides, and angles.

Programming Skill Objectives:
Identify and define an interpreted computer scripting language. (Scratch and Python) - Programming languages that run directly without being compiled.
Create text based code in JES (Jython Environment for Students) and save into their file area with proper extension.  (
Use following commands to draw shapes and designs with Turtles.
Use following commands to create Worlds and Turtles.
Troubleshoot and solve coding errors and problems.
Run code from written programs and from Interactions Window.
Define and use Functions
Use the "for i in range(x)" commands to do repeats.
Use comments in program to describe what code will do.

Lesson Objectives:

Students write and save a Python Code file named in their file area using JES
Students demonstrate how to open JES.
Students demonstrate how to open JES with the "python" command.
Student program draws square and triangle with proper dimensions.

1.  Use JES to draw a square using combinations of turtle.forward() and turtle.turn() commands.
2.  Use JES to draw a triangle using combinations of urtle.forward() and turtle.turn() commands.
3.  Write and save a program in JES that draws a square and a triangle.  Save as in student's file area.
4.  Run student program with JES.

1.  Define Functions in Python that draw square and triangle.
2.  Use parameters to all user to define size of shape.
3.  Create Designs using different colors and spirals.

Session 1:  Using the Python with JES

1.  Review Drawing shapes with Scratch.
2.  Introduce text based programming Languages.  (Python, Java, C# . . .)
3.  Demonstrate Python with JES. 
    a. Click JES icon
    b. create world and turtle:

    c. Save file as "" in file area.
    d. Click "Load Program" to intitiate the World.
    e. Your World should look like:

4.  Students use Interactions Area to draw a square.  (Trial and error - Teacher provide guidance as needed)

    Example Commands:

        turtle.color = red
        turtle.penWidth = 10

5.  Students use Interactions Area to draw a triangle.
6.  Students explore drawing different shapes and paths with Python commands.

Session 2:  Creating Python Programs with JES

1.  Review drawing with Python and Turtle and JES
2.  Using Interactions is good for short experiments.  Longer programs need to be coded and saved.
3.  Demonstrate JES - do simple program and save:  (

4.  Run program:
a. Click "Load Program."
b. Click "Yes" to save Program
c. Navigate to your File Area and save as: ""

5.  Students create, save, and run a triangle program.

Session 3: Using Functions to create designs

1. Demonstrate Repeat Statements and Functions to create a spiral Square - emphasize the use of tabs in Python.

2. Students write code for Square Spriral by adding lines 13 to 24 to their Square program.
3. Students run their programs.
    a. Save your program
    b. Click "Load Program"
    c. Click "Yes" to Save
    d. Result should look like:

4. Students create, save, and run program for drawing triangles.

Session 5: Using Lists to organize data. Using penUp(), penDown(), and moveTo(x, y) commands.

1. Add a rainbowSpiral function to change colors of the squares every cycle.

a. Type in line 5: "colors = [red, orange, yellow, green, blue]"
b. Type in lines 20 to 28

It should look like:

2. To pick up and move the turtle to a different location in the world, you need to use a "penUp()" command to "pick the pen up" before moving the turtle. Then use the "moveTo(x,y)" command to place the turtle in a new location. Then use "penDown()" to put the pen down again to draw. Type in lines 30 to 40 to practice picking pen up and moving.

The design should look like this:

3. Add lines to the program to make the turtle draw two more small sprirals on the bottom of the picture. Then be creative and see what other designs you can make with spirals.

More Advanced Methods for Designs: (Add to your Square and Spiral Program)
(Substitute "turtle" for "Rebecca" in this sample.)

This is What it looks like when run:

Students write and save a Python Code file named in their file area using JES.
Students demonstrate how to JES and create Turtles and Worlds.
Students demonstrate how to run their programs "" and ""
Student program draws square and triangle with proper dimensions.