one . Cherry trees
# coding=utf-8 # Draw a cherry blossom import turtle import random from turtle import * from
timeimport sleep # Painting the trunk of Cherry Blossom (60,t) def tree(branchLen,t): sleep(0.0005) if
branchLen>3: if 8<= branchLen <=12: if random.randint(0,2) == 0: t.color('snow')
# white else: t.color('lightcoral') # Light coral t.pensize(branchLen / 3) elif branchLen <
8: if random.randint(0,1) == 0: t.color('snow') else: t.color('lightcoral') #
Light coral t.pensize(branchLen / 2) else: t.color('sienna') # Ochre (zhě) colour t.pensize(
branchLen/ 10) # 6 t.forward(branchLen) a = 1.5 * random.random() t.right(20*a)
b= 1.5 * random.random() tree(branchLen-10*b, t) t.left(40*a) tree(branchLen-10*
b, t) t.right(20*a) t.up() t.backward(branchLen) t.down() # Fallen petals def petal(m, t
): for i in range(m): a = 200 - 400 * random.random() b = 10 - 20 * random.
random() t.up() t.forward(b) t.left(90) t.forward(a) t.down() t.color(
'lightcoral') # Light coral t.circle(1) t.up() t.backward(a) t.right(90) t.backward(b)
def main(): # Drawing area t = turtle.Turtle() # canvas size w = turtle.Screen() t.hideturtle()
# Hide brush getscreen().tracer(5,0) w.screensize(bg='wheat') # wheat Wheat t.left(90) t.
up() t.backward(150) t.down() t.color('sienna') # Painting the trunk of Cherry Blossom tree(60,t) # Fallen petals
petal(200, t) w.exitonclick() main()
design sketch

two , cherry blossoms
from turtle import * from random import * from math import * def tree(n,l): pd(
forward(l)# Draw a branch if n>0: b = random()*15+10 # Right branch deflection angle c = random()*15+10 # Left branch deflection angle d
= l*(random()*0.25+0.7) # The length of the next branch # Turn right at a certain angle , Draw the right branch right(b) tree(n-1,d) # Turn left at a certain angle , Draw left branch
left(b+c) tree(n-1,d) # Turn around right(c) else: # Painting leaves right(90) n=cos(radians(heading(
)-45))/4+0.5 pencolor(n,n*0.8,n*0.8) circle(3) left(90) # add to 0.3 Times of falling leaves if(random()
>0.7): pu() # Falling t = heading() an = -40 +random()*40 setheading(an) dis = int(800
*random()*0.5 + 400*random()*0.3 + 200*random()*0.2) forward(dis) setheading(t)
(dis) setheading(t) pu() backward(l)# return bgcolor(0.5,0.5,0.5)# Background color ht()# hide turtle
speed(0)# speed 1-10 gradual ,0 Fastest tracer(0,0) pu()# pen-up backward(100) left(90)# Turn left 90 degree pu()# pen-up
backward(300)# back off 300 tree(12,100)# recursion 7 layer done()
design sketch

three , Falling flowers
from turtle import * import random def drawTree(length): if length>1: if length
<30 and length>14:# Shrink the trunk pensize(4) elif length<15 and length>5:# Within this range of length, it is green leaves
color('#04B486')# pensize(3) elif length<5 and length>1:# safflower color('#FE2E9A')
pensize(2) else: color('#5E5E5E')# Other areas are normal trunks pensize(5) # Random angle and length randangle=2*
random.random() randlen=2*random.random() # Each time you use the function, draw a line segment first , Adjust the angle again , Here is the right angle fd(
length) right(20*randangle) drawTree(length - 10*randlen) # Here is the angle to the left left(40 *
randangle) drawTree(length - 10*randlen)
# Why do you need to turn right again 20 degree ? That's because I turned left altogether 40 degree , use backward back off , It has to be the same angle , Otherwise, the angle will be different and the position will not be right right(20 *
randangle) up() backward(length) down() def fallingFlowers(m): x,y=-1000,-750
for i in range(30): up() goto(x,y) x+=100 down() yval=50 for i in range(m): a =
100*random.random() b = 2*random.random() print(a) if a>59: color('#FE2E9A')
else: color('#04B486') circle(5) up() goto(x,y+(yval*b)) fd(a) yval+=50 down()
setworldcoordinates(-1000,-750,1000,750) tracer(False) fallingFlowers(10)# Drawing fallen leaves
bgcolor("#F5F6CE") color('#5E5E5E') pensize(5) up() goto(0,-700)# Jump to the start of the drawing down()
left(80) fd(140) drawTree(120) input()
If there is a flash back , It's usually a version issue ：
terms of settlement ：