## LESSON – Drawing with Python

### Lesson Objectives

**Using python to draw simple shapes**

### Success Criteria

**understand how to use a drawing turtle module in Python****drawing simple shapes using turtle module****customise and refine shapes using programming skills**

### Keywords

- Turtle
- Graphical User Interface
- Iteration
- Patterns

### Commands

- turtle.pencolor(“Red”)
- turtle.forward(100)
- turtle.right(90)
- turtle.fillcolor(“Brown”)

### Starter

#### Name the following shapes below

**Compare your answers with the person next to you.**

### Task 1 – Drawing lines and getting know the turtle commands

#### Open IDLE (Python GUI)

#### To be able to draw in python on top of your program you need to write this:

import turtle

Write these code in your new python file and **save it as a myShape.py **

When you run (F5) your program below line should have appear on your screen.

These are the commands that helping you to draw the line

turtle.pencolor(“Red”)

turtle.forward(100)

#### Python has many different commands to help you draw different shapes. Here are some of those listed below:

turtle.forward() | Go forward |

turtle.backward() | Go backward |

turtle.right() | Turn right |

turtle.left() | Turn left |

turtle.penup() | Lifts the pen up so you can move the turtle without drawing |

turtle.pendown() | Drops the pen back onto the screen so you can draw |

turtle.fillcolor(“Brown”) | Changes the fill colour to brown(or other colour) |

turtle.pencolor(“Red”) | Changes the pen colour to red (or other colour) |

turtle.begin_fill() | Begins to fill the shape |

turtle.end_fill() | End the filling sequence |

turtle.shape(“turtle”) | Changes the turtle shape from arrow to turtle |

turtle.bgcolor(“lightyellow”) | Changes the background colour of your screen |

#### Change your drawing graphic from arrow to turtle add the following code on top of your program after import turtle:

turtle.shape(“turtle”)

### Task 2 – Drawing a square

You can create different geometric shapes using previously learnt programming skills and above commands.

#### Using above commands; can you try creating an algorithm to draw a square

Remember how many sides and corners in the square. For a square you will probably need a right angle, which is 90 degrees.

If you are stuck with this task hover your mouse to see the solution

### Task 3 – Modify your program and draw Equilateral triangle

Modify your square algorithm and create a Equilateral triangle

for the Equilateral triangle you have to make sure all sides are equal which means its internal angles will be 60 degrees. In your program you should be using external angles.

You have to figure out what is the external angle for an Equilateral triangle.

If you are stuck with this task hover your mouse to see the solution

### Task 4 – Merge your programs to draw Equilateral triangle and Square

By merging your square and Equilateral triangle program you can create a simple house graphic. Like one at the below:

#### Challenge for you to think about in this task is: How does the turtle should walk following end of finishing the square!

#### Does it turn left or right? And remember: internal angles of the Equilateral triangle are 60 degrees. In your program you should be using external angles.

You have to figure out what is the external angle for an Equilateral triangle.

If you are stuck with this task hover your mouse to here see the solution

### Challenge yourself and complete each of the challenges below.

- Draw a rectangle: two of the four sides need to be longer.
- Draw a hexagon: you have to remember! Hexagon has 6 sides and external angle is 60 degrees.

### Task 5 – Drawing tilted shapes

By modify your simple drawing program you can create complex shapes. Have try creating an algorithm to the below shape.

If you are stuck with this task hover your mouse to see the solution

### Final challenge- Draw below flower and honeycomb graphics

By modify your simple drawing program you can create complex shapes. Try creating an algorithm for the below shapes.

### Home learning – due in two weeks

Follow the instructions on the home learning document and complete your task, if you are having problem understanding the task you need to see me before the due date.

Your home learning worksheet in your Show My Homework account.

**Use the below link to help you with your task**

Tesselation

Drawing shapes with turtle

Drawing shapes with turtle