Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit196d46f

Browse files
author
FlyPython
authored
Add files via upload
1 parent6a2b29f commit196d46f

File tree

1 file changed

+77
-0
lines changed

1 file changed

+77
-0
lines changed

‎mooncake.py

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
#!/usr/bin/env python2
2+
#encoding=utf-8
3+
4+
importturtleastt
5+
importmath
6+
importtime
7+
8+
tt.hideturtle()
9+
tt.speed(10)
10+
11+
defdraw_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+
defdraw_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+
foriinrange(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+
defdraw_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+
foriinrange(4):
50+
tt.fd(d)
51+
tt.circle(r,90)
52+
53+
defdraw_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+
defdraw():
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+

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp