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()

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

运行结果:

相关推荐
belldeep4 小时前
python:genesis-world, Genesis-Embodied-AI
人工智能·python·ai·genesis
benchmark_cc5 小时前
A 股、港股、美股如何建立统一的标的主数据格式?
开发语言·python·数据分析·pandas·量化交易·股票数据·quantdash
维克兜率天5 小时前
【维克】趋势型CTA:期货市场的“追涨杀跌“
人工智能·python
取名真是6 小时前
Python 算法知识点从基础到进阶
开发语言·python·算法
梦想不只是梦与想6 小时前
PyTorch、CPU、GPU、CUDA
人工智能·pytorch·python·深度学习·机器学习·cuda
数字融合6 小时前
透明化视频孪生危化安全管控解决方案
人工智能·python·安全
别问!问就是全会8 小时前
Jupyter Notebook 安装包下载|单元格分块运行,图表直接内嵌
ide·python·其他·jupyter
深蓝AI8 小时前
Python 缓存击穿实测:16 个并发请求如何只回源 1 次
python
benchmark_cc8 小时前
用 00700.HK 做港股行情清洗:字段核对、校验与个人量化开发实践
python·数据分析·pandas·量化交易·股票数据·quantdash
zh路西法9 小时前
【PACE】面向永磁同步电机PMSM 执行器的参数辨识与能耗感知强化学习 Sim-to-Real
python·cma-es·pmsm·sim-to-real·issac·pace