3
3
4
4
def cherryTree (branch , t ):
5
5
if branch > 4 :
6
+ # 枝干数
6
7
if 7 <= branch <= 13 :
7
8
# 随机数生成
8
9
if random .randint (0 , 3 ) == 0 :
@@ -15,8 +16,8 @@ def cherryTree(branch, t):
15
16
if random .randint (0 , 2 ) == 0 :
16
17
t .color ('snow' )
17
18
else :
18
- # 设置樱花树叶颜色
19
- t .color ('green' )# 樱花树颜色
19
+ # 设置树叶颜色
20
+ t .color ('green' )
20
21
t .pensize (branch / 5 )
21
22
else :
22
23
t .color ('Peru' ) # 树干颜色
@@ -63,18 +64,18 @@ def petal(m, t):
63
64
def des_word ():
64
65
t .color ('LightCoral' ) # 字体颜色设置
65
66
t .hideturtle ()
66
- t .goto (- 50 ,- 130 )
67
+ # t.goto(-50, -130)
68
+ t .goto (- 60 ,- 170 )
67
69
t .pu ()
68
- # 昨日雪如花,今日花如雪,山樱如美人,红颜易消歇。
69
- t .write ('昨日雪如花,' ,move = False , align = 'center' , font = ('Arial' , 20 , 'normal' ))
70
+ t .write ('姹紫嫣红桃花笺,' ,move = False , align = 'center' , font = ('Arial' , 20 , 'normal' ))
70
71
t .pd ()
71
72
72
73
t .pu ()
73
- t .goto (90 ,- 130 )
74
- t .write ('今日花如雪' , move = False , align = 'center' , font = ('Arial' , 20 , 'normal' ))
74
+ # t.goto(90, 130)
75
+ t .goto (150 ,- 170 )
76
+ t .write ('繁花似锦为君妍' , move = False , align = 'center' , font = ('Arial' , 20 , 'normal' ))
75
77
t .pd ()
76
78
77
-
78
79
# 绘图区域
79
80
t = turtle .Turtle ()
80
81
# 画布大小 获取到屏幕
0 commit comments