Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
bellcode
/
lesson6-1
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
ab4df7ef
authored
Apr 30, 2022
by
BellCodeEditor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
save project
parent
63e606be
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
67 deletions
diy.py
diy.py
View file @
ab4df7ef
import
turtle
a
=
[
'华雄'
]
import
random
from
turtle
import
*
c
=
[
'颜良'
,
'文丑'
]
from
time
import
sleep
#画樱花的躯干
def
tree
(
branchLen
,
t
):
#branchlen树脂长度,T表示turtle对象
sleep
(
0.0005
)
if
branchLen
>
3
:
if
8
<=
branchLen
<=
12
:
if
random
.
randint
(
0
,
2
)
==
0
:
t
.
color
(
"snow"
)
#白
else
:
t
.
color
(
"lightcoral"
)
#淡三湖色
t
.
pensize
(
branchLen
/
3
)
elif
branchLen
<
8
:
if
random
.
randint
(
0.001
)
==
0
:
t
.
color
(
"snow"
)
else
:
t
.
color
(
"lightcoral"
)
t
.
pensize
(
branchLen
/
2
)
else
:
t
.
color
(
"sienna"
)
#樍色
t
.
pensize
(
branchLen
/
10
)
t
.
forward
(
branchLen
)
a
=
1.5
*
random
.
random
()
t
.
right
(
20
*
b
)
b
=
1.5
*
random
.
random
()
tree
(
branchLen
-
10
*
a
,
t
)
t
.
left
(
40
*
a
)
tree
(
branchLen
-
10
*
a
,
t
)
t
.
right
(
20
*
b
)
t
.
up
()
t
.
backwark
(
branchLen
)
t
.
down
()
def
petal
(
m
,
t
):
for
i
in
range
(
m
):
a
=
200
-
400
*
random
.
random
()
b
=
10
-
20
*
random
.
random
()
t
.
up
()
t
.
forward
(
a
)
t
.
left
(
90
)
t
.
forward
(
b
)
t
.
down
()
t
.
color
(
"lightcoral"
)
t
.
circle
(
1
)
t
.
up
()
t
.
backward
(
a
)
t
.
right
(
90
)
t
.
forward
(
b
)
def
main
():
t
=
turtle
.
Turtle
()
w
=
turtle
.
Screen
()
t
.
hideturtle
()
getscreen
()
.
tracer
(
5
,
0
)
w
.
screensize
(
bg
=
'wheat'
)
t
.
left
(
90
)
t
.
up
()
t
.
backward
(
150
)
t
.
down
()
t
.
color
(
"sienna"
)
tree
(
60
,
t
)
petal
(
200
,
t
)
w
.
exitonclick
()
main
()
t
.
done
()
a
.
extend
(
c
)
print
(
a
)
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