Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
bellcode
/
lesson3-1-1_DIY1
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
2d9c7901
authored
3 years ago
by
BellCodeEditor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
save project
parent
c2f1308f
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
64 additions
and
2 deletions
diy1.py
diy1.py
View file @
2d9c7901
# 利用write()帮助悟空给诺依回信吧~
\ No newline at end of file
from
turtle
import
*
"""
武城玛酷机器人编程中心
"""
# 设置色彩模式是RGB:
colormode
(
255
)
lt
(
90
)
lv
=
14
l
=
120
s
=
45
width
(
lv
)
# 初始化RGB颜色:
r
=
0
g
=
0
b
=
0
pencolor
(
r
,
g
,
b
)
penup
()
bk
(
l
)
pendown
()
fd
(
l
)
def
draw_tree
(
l
,
level
):
global
r
,
g
,
b
# save the current pen width
w
=
width
()
# narrow the pen width
width
(
w
*
3.0
/
4.0
)
# set color:
r
=
r
+
1
g
=
g
+
2
b
=
b
+
3
pencolor
(
r
%
200
,
g
%
200
,
b
%
200
)
l
=
3.0
/
4.0
*
l
lt
(
s
)
fd
(
l
)
if
level
<
lv
:
draw_tree
(
l
,
level
+
1
)
bk
(
l
)
rt
(
2
*
s
)
fd
(
l
)
if
level
<
lv
:
draw_tree
(
l
,
level
+
1
)
bk
(
l
)
lt
(
s
)
# restore the previous pen width
width
(
w
)
speed
(
"fastest"
)
draw_tree
(
l
,
4
)
done
()
\ No newline at end of file
This diff is collapsed.
Click to expand it.
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