Commit 4f8da373 by BellCodeEditor

save project

parent 22ce3fce
Showing with 14 additions and 3 deletions
import turtle
import random
pen = turtle.Turtle()
pen.color('sienna')
pen.speed(10000)
# 画布大小
w = turtle.Screen()
w.bgcolor('wheat') # wheat小麦
# 移动到起点
pen.left(90)
pen.up()
......@@ -14,7 +13,10 @@ pen.backward(150) # 后退
pen.down()
def tree(n):
if n>=50:
pen.pensize(n/10)
pen.forward(n)
a=random.randint(0,30)
b=random.randint(0,15)
pen.right(30)
tree(n-10)
pen.left(60)
......@@ -23,5 +25,13 @@ def tree(n):
pen.up()
pen.backward(n)
pen.down()
if b<=12:
c=random.randint(1,2)
if c==1:
pen.color("snow")
else:
pen.color("lightcoral")
pen.pensize(a*3)
tree(100)
turtle.done()
turtle.done()
\ No newline at end of file
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