【python】turtle龟绘制开了花朵的树,程序画图
天啊,没想到python龟绘制的图居然这么美腻!
代码传送门:
import turtle
import random
from turtle import *
from time import sleep
t = turtle.Turtle()
w = turtle.Screen()
def tree(branchLen, t):
if branchLen > 3:
if 8 <= branchLen <= 12:
if random.randint(0, 2) == 0:
t.color('snow')
else:
t.color('lightcoral')
t.pensize(branchLen / 3)
elif branchLen < 8:
if random.randint(0, 1) == 0:
t.color('snow')
else:
t.color('lightcoral')
t.pensize(branchLen / 2)
else:
t.color('sienna')
t.pensize(branchLen / 10)
t.forward(branchLen)
a = 1.5 * random.random()
t.right(20*a)
b = 1.5 * random.random()
tree(branchLen-10*b, t)
t.left
相关知识
python turtle玫瑰花绘制效果和源代码
python 玫瑰花程序
【Python实用工具】(情人节献礼)turtle函数绘制动态玫瑰花
python玫瑰花代码讲解
python玫瑰花代码简单
玫瑰花的python程序代码
海龟画图 python太阳花
python 3:turtle图形库,绘制简单的图形
Python编程实现花卉图案绘制与色彩搭配技巧详解
python画玫瑰花代码简单
原文链接: 【python】turtle龟绘制开了花朵的树,程序画图 https://www.huajiangbk.com/newsview467133.html
| 上一篇: 【喀喇沁旗世杰花卉种子繁育基地招... | 下一篇: 花种,花籽,花种批发,花卉种子,... |
推荐分享

- 1明日花キララ:明日花绮罗年度... 17996
- 2明日花キララ(明日花绮罗)经... 10357
- 3兰花叶子扭的是什么兰 8088
- 4君子兰什么品种最名贵 十大名... 6713
- 5十大致癌花卉排行榜,哪些花卉... 6423
- 6李晓明工笔牡丹(魏紫)《牡丹... 6186
- 7家庭养花知识大全 家庭养花有... 5791
- 8家庭养花风水知识 家庭养花“... 5520
- 9花圈挽联怎么写? 5025
- 10世界上最名贵的10种兰花图片... 4882




