About
Sign Up
Run
Check
main.py
shapes.py
Powered by
Guess a number between 1 and 5:
# This is a custom module we've made. # Modules are files full of code that you can import into your programs. # This one teaches our turtle to draw various shapes. import turtle def draw_circle(turtle, color, size, x, y): turtle.penup() turtle.color(color) turtle.fillcolor(color) turtle.goto(x,y) turtle.pendown() turtle.begin_fill() turtle.circle(size) turtle.end_fill() def draw_triangle(turtle, color, size, x, y): turtle.penup() turtle.color(color) turtle.fillcolor(color) turtle.goto(x,y) turtle.pendown() turtle.begin_fill() for i in range (3): turtle.forward(size*3) turtle.left(120) turtle.end_fill() turtle.setheading(0) def draw_square(turtle, color, size, x, y): turtle.penup() turtle.color(color) turtle.fillcolor(color) turtle.goto(x,y) turtle.pendown() turtle.begin_fill() for i in range (4): turtle.forward(size*2) turtle.left(90) turtle.end_fill() turtle.setheading(0) def draw_star(turtle, color, size, x, y): turtle.penup() turtle.color(color) turtle.fillcolor(color) turtle.goto(x,y) turtle.pendown() turtle.begin_fill() turtle.right(144) for i in range(5): turtle.forward(size*2) turtle.right(144) turtle.forward(size*2) turtle.end_fill() turtle.setheading(0)