Commit 9a3571db by BellCodeEditor

auto save

parent 576b5884
Showing with 45 additions and 0 deletions
import turtle
import random
a = turtle.Turtle()
a.color('sienna')
# 画布大小
w = turtle.Screen()
w.bgcolor('wheat') # wheat小麦
# 移动到起点
a.left(90)
a.up()
a.backward(150) # 后退
a.down()
a.speed(0)
# ikun
# ikun
# ikun lightcoral
def tree(x):
if x>=0:
if x <=20:
color_list=["green","yellow"]#,"red","blue","white","black","pink","lightblue","lightgreen"
color=random.choice(color_list)
a.color(color)
a.pensize(x/3)
else:
a.color("sienna")
a.pensize(x/10)
a.forward(x)
angle=random.random()
a.right(30*angle)
length=1.5*random.random()
tree(x-10*length)
a.left(60*angle)
tree(x-10*length)
a.right(30*angle)
a.penup()
a.forward(-x)
a.pendown()
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