@sandrew588/

Turtle Graphics Drawing

Python (with Turtle)

No description

fork
loading
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
import turtle

# look up more fucntions at https://docs.python.org/2/library/turtle.html#turtle.color

# Defines square square function
def square():
    turtle.fill("green") # sets the color of the line
    turtle.hideturtle() # hides the turtle figure
    turtle.speed(14) # controls the speed of the turtle (1=slowest, increasing speed)
    turtle.forward(100) # moves the turle forward 100 pixels
    turtle.left(90) # turns the turtle left 90 degrees
    turtle.color("brown")
    turtle.forward(100)
    turtle.left(90)
    turtle.forward(100)
    turtle.color("purple")
    turtle.left(90)
    turtle.forward(100)
    
    
#define triangle drawing function
def triangle():
    turtle.hideturtle()
    turtle.speed(14)
    turtle.forward(100)
    turtle.left(120)
    turtle.color("blue")
    turtle.forward(100)
    turtle.left(120)
    turtle.color("red")
    turtle.forward(100)
    
    
# Create loop that calles square, trinagle, and circle functions
while True:  
    square() # call the square function
    triangle() # call the triangle function
    square()
    triangle()
    turtle.circle(20) # call the built in circle function

result
console