Commit 5507fdc9 by BellCodeEditor

save project

parent 1e9a922e
Showing with 15 additions and 3 deletions
......@@ -4,7 +4,9 @@ pen = turtle.Turtle()
pen.color('sienna')
# 画布大小
w = turtle.Screen()
w.bgcolor('wheat') # wheat小麦
w.bgcolor('wheat')
# 移动到起点
pen.left(90)
......@@ -13,8 +15,18 @@ pen.backward(150) # 后退
pen.down()
def tree(n):
if n>=10:
if n>=0:
if n<=12:
c=['snow','lightcoral']
cr=random.choice(c)
pen.pencolor(cr)
pen.pensize(n/3)
else:
pen.pencolor('sienna')
pen.pensize(n/10)
pen.forward(n)
a=random.randint(0,30)
l=random.randint(1,15)
......@@ -27,5 +39,5 @@ def tree(n):
pen.backward(n)
pen.down()
tree(50)
tree(60)
turtle.done()
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment