-
Notifications
You must be signed in to change notification settings - Fork 42
/
Copy pathPython turtle code 3.py
82 lines (69 loc) · 1.51 KB
/
Python turtle code 3.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
76
77
78
79
80
81
82
import turtle as t
s=t.Screen()
s.bgcolor("black")
c=t.clone()
k=t.clone()
t.speed(0)
def shape (angle,side,lim):
rev_dir = 5
t.forward(side)
if side % (rev_dir*2) == 0:
angle = angle +0.4
t.pencolor("white")
t.pensize(4)
s.bgcolor("white")
else:
angle = angle +0.2
t.pencolor("silver")
t.pensize(2)
s.bgcolor("black")
t.right(angle)
side = side + 2
if side < lim:
shape(angle,side,lim)
col=('black' , 'gold' , 'black' , 'gold' , 'black' , 'gold')
t.speed(0)
t.pensize(3)
for i in range(200):
c.color(col[i%6])
c.forward(i*1.5)
c.left(59)
c.width(3)
if i<26:
if i%3==0:
s.bgcolor('white')
else:
s.bgcolor('black')
elif i>=26 and i<74:
if i%2 ==0:
s.bgcolor('white')
else:
s.bgcolor('black')
else:
if i%3==0:
s.bgcolor('white')
else:
s.bgcolor('black')
k.pen(pencolor="cyan",pensize=7,speed=7)
k.penup()
k.goto(240,-200)
k.pendown()
k.goto(240,-300)
k.goto(300,-250)
k.goto(240,-200)
k.penup()
k.goto(360,-200)
k.pendown()
k.goto(320,-250)
k.goto(360,-300)
k.goto(400,-250)
k.goto(360,-200)
k.penup()
k.goto(360,-250)
k.pendown()
k.goto(400,-300)
t.done()
angle = 120
side = 0
lim = 800
shape(angle,side,lim)