repl.it
@CHanlon/

Project One

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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
import turtle


# Circle Drawing Function
def draw_circle(t_name, color, c_size, x, y, angle):
    t_name.penup()
    t_name.color(color)
    t_name.fillcolor(color)
    t_name.goto(x, y)
    t_name.pendown()
    t_name.setheading(0)
    t_name.left(angle)
    t_name.begin_fill()
    t_name.circle(c_size)
    t_name.end_fill()

# Triangle drawing function
def draw_triangle(t_name, side_length, tri_color, tri_angle, tri_x, tri_y):
  
    #Sets the color of the turtle
    t_name.pencolor(tri_color)
    t_name.fillcolor(tri_color)
    t_name.fill(True)

    #Tells the turtle where to go
    t_name.penup()
    t_name.goto(tri_x, tri_y)

    #Sets the angle
    t_name.setheading(0)
    t_name.left(tri_angle)

    #Draw the triangle
    for i in range(3):
        t_name.forward(side_length)
        t_name.left(120)

    t_name.fill(False)

def draw_rect(t_name, length, width, rect_color, rect_angle, rect_x, rect_y):

    # Sets the color of the turtle
    t_name.pencolor(tri_color)
    t_name.fillcolor(tri_color)
    t_name.fill(True)

    # Tells the turtle where to go
    t_name.penup()
    t_name.goto(tri_x, tri_y)

    # Sets the angle
    t_name.setheading(0)
    t_name.left(tri_angle)

    #Draws the shape
    for i in range(2):
        t_name.forward(length)
        t_name.left(90)
        t_name.forward(width)
        t_name.left(90)

    t_name.fill(False)

###########################################################

#Setup
tommy = turtle.Turtle()     # Creates our turtle
tommy.speed(100)            # Increases the draw speed




# End of Program
tommy.hideturtle()          # Makes the Turtle disappear at the end
result
console
?