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

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

运行结果:

相关推荐
weixin_462446231 分钟前
Python 使用 Chainlit + Ollama 快速搭建本地 AI 聊天应用
人工智能·python·ollama·chainlit
小北方城市网1 分钟前
SpringBoot 集成 MinIO 实战(对象存储):实现高效文件管理
java·spring boot·redis·分布式·后端·python·缓存
UR的出不克3 分钟前
Python实现SMZDM数据处理系统:从爬虫到数据分析的完整实践
爬虫·python·数据分析
不如语冰5 分钟前
AI大模型入门1.3-python基础-类
人工智能·pytorch·python·类和方法
一代土怪6 分钟前
django中实时更新数据库
python·django
学习3人组7 分钟前
AI视觉Python方向专业技术名词
开发语言·人工智能·python
Blossom.11810 分钟前
大模型分布式训练通信优化:从Ring All-Reduce到分层压缩的实战演进
人工智能·分布式·python·深度学习·神经网络·机器学习·迁移学习
山后太阳14 分钟前
嵌入式TensorFlow Lite教程,从环境搭建到模型部署
人工智能·python·tensorflow
UR的出不克16 分钟前
基于 mitmproxy 的大众点评数据采集实战:自动化抓取景点与评论数据
运维·爬虫·python·自动化
程序员:钧念17 分钟前
机器学习与深度学习的区别
人工智能·python·gpt·深度学习·机器学习