Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Administrator
/
level3-lesson15-diy3
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
93eafe6f
authored
3 years ago
by
BellCodeEditor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
save project
parent
9d9755fb
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
32 deletions
my_tree.py
my_tree.py
View file @
93eafe6f
import
turtle
import
time
import
random
import
pygame
time1
=
time
.
time
()
pen
=
turtle
.
Turtle
()
pen
=
turtle
.
Turtle
()
pen
.
color
(
'sienna'
)
# 画布大小
w
=
turtle
.
Screen
()
w
.
bgcolor
(
'wheat'
)
# wheat小麦
l
=
[
'snow'
,
'lightcoral'
]
pen
.
speed
(
10000000000
)
a
=
l
def
aaa
(
n
):
if
n
>=
0
:
if
n
<=
15
:
pen
.
pensize
(
n
)
pen
.
pencolor
(
random
.
choice
(
a
))
else
:
pen
.
pensize
(
n
/
10
)
pen
.
color
(
'sienna'
)
l
=
random
.
randint
(
5
,
15
)
g
=
random
.
randint
(
15
,
20
)
pen
.
forward
(
n
)
pen
.
right
(
g
)
aaa
(
n
-
l
)
pen
.
left
(
g
*
2
)
aaa
(
n
-
l
)
pen
.
right
(
g
)
pen
.
up
()
pen
.
backward
(
n
)
pen
.
down
()
# 移动到起点
pen
.
left
(
90
)
pen
.
up
()
pen
.
backward
(
4
50
)
# 后退
pen
.
backward
(
1
50
)
# 后退
pen
.
down
()
aaa
(
80
)
time2
=
time
.
time
()
print
(
time2
-
time1
)
pen
.
forward
(
100
)
#绘制二叉树
pen
.
right
(
30
)
pen
.
forward
(
50
)
pen
.
backward
(
50
)
pen
.
left
(
60
)
pen
.
forward
(
50
)
pen
.
backward
(
50
)
pen
.
right
(
30
)
pen
.
backward
(
100
)
turtle
.
done
()
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