Commit d3ea3b8d by BellCodeEditor

save project

parent ac2fbcb7
Showing with 17 additions and 8 deletions
from turtle import *
from random import *
from random import random as rdm,randint as rdt,choice as chc
def tree(n):
if n >= 0:
if n <= 12:
colorlist = ["snow","lightcoral"]
color = chc(colorlist)
pen.color(color)
pen.pensize(n / 3)
else:
pen.color('sienna')
pen.pensize(n /10)
pen.fd(n)
pen.rt(30)
tree(n - 10)
pen.lt(60)
tree(n - 10)
pen.rt(30)
angle = rdt(0,30)
pen.rt(angle)
leng = 15 * rdm()
tree(n - leng)
pen.lt(angle * 2)
tree(n - leng)
pen.rt(angle)
pen.pu()
pen.bk(n)
pen.pd()
pen = Pen()
pen.color('sienna')
#pen.ht()
pen.ht()
# 画布大小
w = Screen()
w.bgcolor('wheat') # wheat小麦
......
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