Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Administrator
/
lesson5_2
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
61f95a66
authored
Jul 03, 2022
by
BellCodeEditor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
auto save
parent
c20f0945
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
101 additions
and
0 deletions
diy1.py
kkk.py
diy1.py
0 → 100644
View file @
61f95a66
每次移动都增加画笔移动的长度,并旋转
91
°,重复执行
300
次,查看效果
"""
import turtle
pen = turtle.Pen()
for i in range(300):
pen.forward(i)
pen.right(91)
pen.hideturtle()
pen.done()
kkk.py
0 → 100644
View file @
61f95a66
import
turtle
as
t
t
.
speed
(
0
)
def
draw
(
r
):
# 画一个风车的棒子
t
.
pensize
(
4
)
# 棒子4像素粗
t
.
penup
()
t
.
goto
(
0
,
0
)
t
.
pendown
()
t
.
goto
(
0
,
-
150
)
t
.
pensize
(
1
)
for
i
in
range
(
4
):
t
.
setheading
(
i
*
90
+
r
)
t
.
penup
()
t
.
goto
(
0
,
0
)
t
.
pendown
()
# 浅蓝色三角形
t
.
fillcolor
(
'#50B2F8'
)
t
.
begin_fill
()
t
.
forward
(
100
)
t
.
left
(
150
)
t
.
forward
(
70
)
t
.
end_fill
()
# 靠近中心的深蓝色三角形
t
.
fillcolor
(
'#063EC5'
)
t
.
begin_fill
()
t
.
left
(
30
)
t
.
forward
(
40
)
t
.
left
(
90
)
t
.
forward
(
35
)
t
.
end_fill
()
draw
(
30
)
# 尝试不同的角度,叶子已经可以转到我们想要的角度了
t
.
done
()
for
r
in
range
(
0
,
360
*
100
,
3
):
# 这里是旋转100圈,也可以用while循环,让它不停转,步长3对应的是转速,也可以改为1、2看看效果
t
.
tracer
(
False
)
t
.
clear
()
draw
(
r
)
time
.
sleep
(
0.01
)
t
.
hideturtle
()
t
.
tracer
(
True
)
import
turtle
as
t
import
time
def
draw
(
r
):
# 画一个风车的棒子
t
.
pensize
(
4
)
# 棒子4像素粗
t
.
penup
()
t
.
goto
(
0
,
0
)
t
.
pendown
()
t
.
goto
(
0
,
-
150
)
t
.
pensize
(
1
)
for
i
in
range
(
4
):
t
.
setheading
(
i
*
90
+
r
)
t
.
penup
()
t
.
goto
(
0
,
0
)
t
.
pendown
()
# 浅蓝色三角形
t
.
fillcolor
(
'#50B2F8'
)
t
.
begin_fill
()
t
.
forward
(
100
)
t
.
left
(
150
)
t
.
forward
(
70
)
t
.
end_fill
()
# 靠近中心的深蓝色三角形
t
.
fillcolor
(
'#063EC5'
)
t
.
begin_fill
()
t
.
left
(
30
)
t
.
forward
(
40
)
t
.
left
(
90
)
t
.
forward
(
35
)
t
.
end_fill
()
# 用速度1播放一次绘制过程
t
.
speed
(
1
)
draw
(
0
)
for
r
in
range
(
0
,
360
*
100
,
3
):
# 这里是旋转100圈,也可以用while循环,让它不停转,步长3对应的是转速,也可以改为1、2看看效果
t
.
tracer
(
False
)
t
.
clear
()
draw
(
r
)
time
.
sleep
(
0.01
)
t
.
hideturtle
()
t
.
tracer
(
True
)
t
.
done
()
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment