-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdraw_shape.py
More file actions
executable file
·52 lines (43 loc) · 878 Bytes
/
draw_shape.py
File metadata and controls
executable file
·52 lines (43 loc) · 878 Bytes
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
#!/usr/bin/env python
import turtle
def draw_square():
window=turtle.Screen()
window.bgcolor("red")
brad = turtle.Turtle()
brad.shape("turtle")
brad.color("blue")
brad.speed(0.9)
for i in range(4):
brad.forward(100)
brad.right(90)
window.exitonclick()
def draw_triangle():
window=turtle.Screen()
window.bgcolor("red")
brad = turtle.Turtle()
brad.shape("turtle")
brad.color("blue")
brad.speed(0.9)
for i in range(3):
brad.forward(100)
brad.right(120)
window.exitonclick()
def draw_circle():
window=turtle.Screen()
window.bgcolor("red")
brad = turtle.Turtle()
brad.shape("turtle")
brad.color("blue")
brad.speed(0.9)
brad.circle(100)
window.exitonclick()
def main():
shape='circle'
if (shape=='square'):
draw_square()
elif (shape=='circle'):
draw_circle()
else: # (shape=='triangle'):
draw_triangle()
#draw_shape(shape)
main()