-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
73 lines (61 loc) · 1.57 KB
/
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
import turtle
import random
def draw_leg(scale):
turtle.left(90)
turtle.forward(30 * scale)
turtle.left(90)
turtle.forward(15 * scale)
turtle.right(90)
turtle.forward(10 * scale)
turtle.right(90)
turtle.forward(30 * scale)
turtle.right(85)
turtle.forward(45 * scale)
turtle.left(85)
def draw_two_legs(scale):
draw_leg(scale)
turtle.forward(7 * scale)
draw_leg(scale)
def draw_long_dog(length, scale, x, y):
turtle.penup()
turtle.goto(x, y)
turtle.pendown()
turtle.forward(float(length) * scale)
turtle.left(45)
turtle.forward(35 * scale)
turtle.right(45)
turtle.forward(35 * scale)
turtle.right(40)
turtle.forward(25 * scale)
turtle.left(40)
turtle.forward(45 * scale)
turtle.right(110)
turtle.forward(25 * scale)
turtle.right(70)
turtle.forward(40 * scale)
turtle.left(45)
turtle.forward(90 * scale)
turtle.right(45)
turtle.forward(25 * scale)
draw_two_legs(scale)
turtle.forward(float(length) * scale * 0.65)
draw_two_legs(scale)
turtle.right(85)
turtle.forward(45 * scale)
turtle.goto(x, y)
turtle.setheading(0)
def click(x, y):
print(f"{x} {y}")
turtle.color(random.random(), random.random(), random.random())
draw_long_dog(500, 0.5, x, y)
turtle.color(1, 0, 0)
turtle.pensize(2)
turtle.speed(0)
draw_long_dog(500, 1, -500, 500)
turtle.color(0, 1, 0)
draw_long_dog(500, 0.5, -500, -100)
# for i in range(10):
# draw_long_dog(500, 0.5, 0, 0)
# turtle.right(15 * i)
turtle.onscreenclick(click)
turtle.done()