...

Spiral Art

In this class, students will learn how to create Spiral Art using the Turtle graphics library and For loop. Through this project, students will have the opportunity to apply their knowledge and create their own unique Spiral Art pieces.
The lesson will cover the following topics:


  •     Introduction to the Turtle graphics library
  •     Understanding the For loop
  •     Techniques to draw various types of Spiral Art
Step 1: Let's start coding
  • In your logged-in trinket account click on New Trinket -> Python

  • Or Open the blank Python template trinket: Open New.

  • What is Turtle library?

    In Python, a library is a reusable chunk of code you can include in your programs and use pre-existing functionality.

    Turtle is a graphic library for Python. Using Turtle, we can easily draw in a drawing board.

  • The first step is to import the Turtle module. Place import statements at the top of your code.

  • Next
    Step 2: Explore Turtle Functions

    Now, let's explore some essential Turtle functions. We'll start by drawing a circle and filling it with a colour.
    We will use the following commands:

  • speed(number) - set the speed of your drawing from 0 to 10
  • penup() - This command lifts the turtle's writing pen, so it won't leave a trace while moving.
  • pendown() - With this command, we put the turtle's writing pen back down, allowing it to draw on the screen.
  • goto(x,y) - Use this command to navigate the turtle to a specific coordinate on the screen. The (x, y) values represent the horizontal and vertical positions.
  • color("colourName") - This command sets the colour of the turtle's pen or fill to the specified colour name, such as "blue" in our case.
  • begin_fill() and end_fill() - These commands mark the beginning and end of the shape that we want to fill with the selected colour.
  • forward(number) - Use this command to move the turtle forward by a specified number of pixels.
  • right(angle) and left(angle) - These commands allow the turtle to turn right or left by the specified angle.

  • Type the code as follows:

    Prev Next
    Step 3: What is FOR loop

    A for loop is used for iterating over a sequence or performing repetitive tasks. With the for loop, we can execute a set of statements, once for each item in a list or as many times as indicated.

    Example:

    Print each fruit in a fruit list:

    The range() Function

    To loop through a set of code a specified number of times, we can use the range() function

    This piece of code prints the same value 6 times

    Prev Next
    Step 4: Spiral Art 1
  • Create a new trinket
  • The first step is to import the Turtle module. Place import statements at the top of your code.
  • Set the drawing speed to 0 (fastest speed).
  • We will create spiral art using CIRCLE
  • Prev Next
    Step 5: Spiral Art 2
  • Create a new trinket
  • The first step is to import the Turtle module. Place import statements at the top of your code.
  • Set the drawing speed to 0 (fastest speed).
  • We will create spiral art using forward lines and turn
  • Prev Next
    Step 6: Spiral Art 3
  • Create a new trinket
  • The first step is to import the Turtle module. Place import statements at the top of your code.
  • Set the drawing speed to 0 (fastest speed).
  • We will create spiral art with changing the radius of the Circle
  • Prev Next
    Step 7: Spiral Art 4
  • Create a new trinket
  • The first step is to import the Turtle module. Place import statements at the top of your code.
  • Set the drawing speed to 0 (fastest speed).
  • Cobmine Line forward and turn to create an spiral art
  • Prev Next
    Step 8: Spiral Art 5
  • Create a new trinket
  • The first step is to import the Turtle module. Place import statements at the top of your code.
  • Set the drawing speed to 0 (fastest speed).
  • We will create spiral art using For loop in anotehr For loop
  • Prev Next
    Step 9: Spiral Art 6
  • Create a new trinket
  • The first step is to import the Turtle module. Place import statements at the top of your code.
  • Set the drawing speed to 0 (fastest speed).
  • Prev Next
    Step 10: Save your work

  • If you don't have a Trinket account, click the down arrow and then click Link. This will give you a link that you can save and come back to later.
  • If you have a Trinket account, you can click Remix to save your own copy of the trinket.
  • Prev Next
    Complete and Share

    Submit your final project



    Copy your Trinket Url

  • Click Share->Link
  • Copy the link to share your code
  • Paste link into the field
  • Prev