Commit 4184730d by BellCodeEditor

auto save

parent a075876f
Showing with 24 additions and 2 deletions
import turtle
import random
pen = turtle.Turtle()
pen.color('sienna')
# 画布大小
w = turtle.Screen()
w.bgcolor('wheat') # wheat小麦
# 移动到起点
pen.left(90)
pen.up()
pen.backward(150) # 后退
pen.down()
def zhu(z):
if z >=0:
if z<=12:
color_list=['green','lightcoral']
color=random.choice(color_list)
pen.color(color)
pen.pensize(z/3)
else:
pen.color('red')
pen.speed(10)
pen.pensize(z / 10)
pen.forward(z)
angle=random.random()
pen.right(30*angle)
length=1.5*random.random()
zhu(z-10*length)
pen.left(60*angle)
zhu(z-10*length)
pen.right(30*angle)
pen.up()
pen.backward(z)
pen.down()
zhu(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