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

Commit 4b30ceb

Browse files
committed
提交代码
1 parent 1428d4a commit 4b30ceb

File tree

1 file changed

+131
-0
lines changed

1 file changed

+131
-0
lines changed

‎fans/tricat/tricat.py

Lines changed: 131 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,131 @@
1+
import turtle as t
2+
import time
3+
'''
4+
部分函数及参数说明:
5+
pen_move():画每个部位时,都必须先抬起画笔,移动到指定位置后落下
6+
pen_set():用来设置画笔的颜色尺寸等
7+
t.setup(width,height):入宽和高为整数时,表示像素;为小数时,表示占据电脑屏幕的比例
8+
t.speed():设置画笔速度
9+
t.goto():以左下角为坐标原点,进行画笔的移动
10+
t.circle(radius,extent):设置指定半径radius的圆,参数为半径,半径为正(负),表示圆心在画笔的左边(右边)画圆,extent为角度,若画圆则无须添加。如:t.circle(-20,90),顺时针,半径20画弧,弧度90
11+
t.seth(degree)绝对角度,将画笔的方向设置为一定的度数方向,0-东;90-北;180-西;270-南
12+
'''
13+
14+
wight=800
15+
height=600
16+
t.setup(wight,height)
17+
t.speed(10)
18+
19+
def pen_move(x,y):
20+
t.penup()
21+
t.goto(x-wight/2+50,y-height/2+50)
22+
t.pendown()
23+
24+
def pen_set(size,color):
25+
t.pensize(size)
26+
t.color(color)
27+
28+
def draw():
29+
#第一个眼睛
30+
pen_move(300,350)
31+
pen_set(2,'black')
32+
t.begin_fill()
33+
t.circle(10)
34+
t.end_fill()
35+
# 第一个眼眶
36+
pen_move(300,350)
37+
t.circle(15)
38+
#第二个眼睛
39+
pen_move(400,350)
40+
t.begin_fill()
41+
t.circle(10)
42+
t.end_fill()
43+
# 第二个眼眶
44+
pen_move(400,350)
45+
t.circle(15)
46+
47+
# 嘴
48+
pen_move(340,300)
49+
t.seth(0)
50+
t.left(45)
51+
t.forward(30)
52+
pen_move(360, 300)
53+
t.seth(180)
54+
t.left(45+270)
55+
t.forward(30)
56+
57+
# 右边脸框
58+
t.seth(0)
59+
pen_move(340,260)
60+
t.circle(90,150)
61+
62+
# 左边脸框
63+
t.seth(180)
64+
pen_move(340,260)
65+
t.circle(-90,140)
66+
# time.sleep(100)
67+
68+
#耳朵
69+
# t.seth(0)
70+
pen_move(260, 400)
71+
t.left(100)
72+
# t.forward(100)
73+
t.circle(-60,70)
74+
75+
#合上耳朵
76+
pen_move(285, 430)
77+
t.left(40)
78+
t.circle(60,50)
79+
80+
#右耳朵
81+
pen_move(380,430)
82+
t.right(90)
83+
t.circle(-60,50)
84+
85+
pen_move(413,410)
86+
t.left(30)
87+
t.circle(60,60)
88+
89+
# 左边身子的线条
90+
pen_move(320, 270)
91+
t.seth(180)
92+
t.left(70)
93+
t.forward(260)
94+
95+
# 身子底部线条
96+
pen_move(230, 30)
97+
t.seth(0)
98+
# t.left(60)
99+
t.forward(240)
100+
101+
# 右边身子线条
102+
pen_move(380, 270)
103+
# t.seth(0)
104+
t.right(70)
105+
t.forward(260)
106+
107+
# 尾巴
108+
pen_move(380+90, 270-240)
109+
t.left(60)
110+
pen_set(6,'black')
111+
t.circle(130,100)
112+
113+
t.left(10)
114+
t.circle(160,40)
115+
t.left(20)
116+
t.circle(100,30)
117+
t.left(50)
118+
t.circle(80,50)
119+
t.left(70)
120+
t.circle(70,40)
121+
t.left(70)
122+
t.circle(60,30)
123+
t.left(70)
124+
t.circle(60,20)
125+
t.left(60)
126+
t.circle(60,10)
127+
t.left(60)
128+
t.circle(10,5)
129+
time.sleep(1)
130+
131+
draw()

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /