Commit f3be936e by BellCodeEditor

auto save

parent a075876f
Showing with 26 additions and 1 deletions
import turtle
import random as r
co = ['snow', 'lightcoral']
def tree(n):
if n>=0:
if n<=12:
pen.color(r.choice(co))
pen.pensize(n/3)
else:
pen.color('sienna')
pen.pensize(n/10)
pen.forward(n)
angle = r.randint(0,30)
length = r.randint(1,10)
pen.right(angle)
tree(n-length)
pen.left(2*angle)
tree(n-length)
pen.right(angle)
pen.up()
pen.bk(n)
pen.down()
pen = turtle.Turtle()
pen.color('sienna')
pen.speed(0.1)
# 画布大小
w = turtle.Screen()
w.bgcolor('wheat') # wheat小麦
......@@ -12,4 +34,7 @@ pen.up()
pen.backward(150) # 后退
pen.down()
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