File tree Expand file tree Collapse file tree 1 file changed +77
-0
lines changed
Expand file tree Collapse file tree 1 file changed +77
-0
lines changed Original file line number Diff line number Diff line change 1+ #!/usr/bin/env python2
2+ #encoding=utf-8
3+
4+ import turtle as tt
5+ import math
6+ import time
7+
8+ tt .hideturtle ()
9+ tt .speed (10 )
10+
11+ def draw_circle (r ):
12+ tt .penup ()
13+ tt .goto (0 , - r )
14+ tt .seth (0 )
15+ tt .pendown ()
16+ tt .pensize (5 )
17+ tt .color ('#F8CD32' ,'#FBA92D' )
18+ tt .begin_fill ()
19+ tt .circle (r )
20+ tt .end_fill ()
21+
22+ def draw_petal (r , n ):
23+ tt .penup ()
24+ tt .goto (0 , - r )
25+ tt .seth (0 )
26+ tt .pendown ()
27+
28+ small_r = math .sin ( math .pi / n ) * r
29+
30+ for i in range (n ):
31+ tt .penup ()
32+ tt .home ()
33+ tt .seth ((360 / n )* i )
34+ tt .fd (r )
35+ tt .left ((360 / n )* 0.5 )
36+ tt .pendown ()
37+ tt .color ('#F0BE7C' )
38+ tt .begin_fill ()
39+ tt .circle (small_r ,180 )
40+ tt .end_fill ()
41+
42+ def draw_square (d , r ):
43+ tt .penup ()
44+ tt .seth (0 )
45+ tt .goto (d / 2 + r , - d / 2 )
46+ tt .left (90 )
47+ tt .pendown ()
48+
49+ for i in range (4 ):
50+ tt .fd (d )
51+ tt .circle (r , 90 )
52+
53+ def draw_word (word , x , y ):
54+ tt .penup ()
55+ tt .goto (x , y )
56+ tt .pendown ()
57+ tt .color ("Gold" )
58+ tt .write (word , font = ("微软雅黑" ,35 , "normal" ))
59+
60+
61+
62+ def draw ():
63+ tt .title ("FlyPython祝您中秋快乐" )
64+ draw_circle (120 )
65+ draw_petal (120 ,18 )
66+ #draw_square(100,10)
67+ draw_word ("五" ,- 50 ,5 )
68+ draw_word ("最" ,0 ,5 )
69+ draw_word ("仁" ,- 50 ,- 40 )
70+ draw_word ("棒" ,0 ,- 40 )
71+ tt .done ()
72+
73+
74+ if __name__ == "__main__" :
75+ time .sleep (10 )
76+ draw ()
77+
You can’t perform that action at this time.
0 commit comments