Python turtle库 实现 随机彩色文字平面批量输出

python 复制代码
# -*- coding: utf-8 -*-
"""
Spyder Editor
This is a temporary script file.
"""
import turtle
import random
import turtle as t
t.colormode(255)
turtle.bgcolor("white")
h=255
l=50#字号
m=60#间隔
n=500
t.penup()
turtle.hideturtle()
def wuxing():
    turtle.pu()
    #turtle.penup()
    
    #turtle.stamp()#central
    #turtle.right(90)
    text="二叉树"
    #turtle.pu()
    for i in text:
        e=random.randint(0,h)
        f=random.randint(0,h)
        g=random.randint(0,h)
        turtle.pencolor(e,f,g)
        turtle.write(i,font=('隶书',l))
        t.fd(m)
t.speed(10000)
for i in range(10):
    turtle.goto(-800, n)  # 到画布中心
    n-=100
    for j in range(10):
        wuxing()

声明:著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。

运行结果:

相关推荐
winfredzhang4 分钟前
深入剖析 wxPython 配置文件编辑器
python·编辑器·wxpython·ini配置
多恩Stone12 分钟前
【3DV 进阶-9】Hunyuan3D2.1 中的 MoE
人工智能·pytorch·python·算法·aigc
爱打代码的小林14 分钟前
网络爬虫基础
爬虫·python
B站计算机毕业设计之家15 分钟前
大数据项目:基于python电商平台用户行为数据分析可视化系统 电商订单数据分析 Django框架 Echarts可视化 大数据技术(建议收藏)
大数据·python·机器学习·数据分析·django·电商·用户分析
weixin_4215850117 分钟前
静态图(Static Graph) vs 动态执行(Eager Execution)
python
杰瑞不懂代码31 分钟前
【公式推导】AMP算法比BP算法强在哪(二)
python·算法·机器学习·概率论
无垠的广袤32 分钟前
【工业树莓派 CM0 NANO 单板计算机】小智语音聊天
人工智能·python·嵌入式硬件·语言模型·树莓派·智能体·小智
BlackPercy39 分钟前
[Matplotlib] 动态视频生成
python·matplotlib
B站计算机毕业设计之家42 分钟前
大数据:基于python唯品会商品数据可视化分析系统 Flask框架 requests爬虫 Echarts可视化 数据清洗 大数据技术(源码+文档)✅
大数据·爬虫·python·信息可视化·spark·flask·唯品会
276695829243 分钟前
闪购商家端 mtgsig
java·python·c#·node·c·mtgsig·mtgsig1.2