-
Notifications
You must be signed in to change notification settings - Fork 26
Expand file tree
/
Copy path04.py
More file actions
62 lines (51 loc) · 1.49 KB
/
04.py
File metadata and controls
62 lines (51 loc) · 1.49 KB
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
from turtle import *
from math import *
speed(0)
bgcolor("black")
goto(0,-40)
# Draw leaves
for i in range(16):
for j in range(18):
color('#FFA216'), rt(90)
circle(150-j*6, 90), lt(90)
circle(150-j*6, 90), rt(180)
circle(40,24)
# Draw flower center
color('black')
shape('circle')
shapesize(0.5)
fillcolor('#8B4513')
golden_ang = 137.508
phi = golden_ang*(pi/180)
for i in range(140):
r = 4*sqrt(i)
theta = i*phi
x = r*cos(theta)
y = r*sin(theta)
penup(), goto(x, y)
setheading(i*golden_ang)
pendown(), stamp()
# Define points to draw letters
def point(x, y):
penup(), goto(x, y), pendown()
color('black'), fillcolor('#FFA216')
begin_fill(), circle(4), end_fill()
# Function to draw 'T'
def draw_T(x, y):
positions_t = [(x, y+30), (x+6, y+30), (x+12, y+30), (x+18, y+30), (x+24, y+30),
(x+12, y+30), (x+12, y+24), (x+12, y+18), (x+12, y+12), (x+12, y+6), (x+12, y)]
for pos in positions_t:
point(*pos)
# Function to draw 'Ú'
def draw_U(x, y):
positions_u = [(x, y+30), (x, y+24), (x, y+18), (x, y+12), (x, y+6),
(x+3, y+3), (x+6, y), (x+12, y-1), (x+18, y), (x+21, y+3),
(x+24, y+6), (x+24, y+12), (x+24, y+18), (x+24, y+24), (x+24, y+30),
(x+12, y+36), (x+16, y+40)]
for pos in positions_u:
point(*pos)
# Draw 'TÚ'
draw_T(-27, -20)
draw_U(7, -20)
hideturtle()
done()