猫史档案馆


【Python作品分享】无限弹屏【教程贴】

用户:余宏松余宏松查看:0 回复:0 评论:0 创建时间:2021-05-25T22:01:44


【作品展示】

center_image

 

【作品介绍】

无喵弹屏哦~·~

 

【作品源代码】

import turtle
import time

mypen = turtle.Pen()


a = 10
while (a > 0):
    myscreen = turtle.Screen()
    myscreen.tracer(0)
    width = 900
    height = 400
    myscreen.setup(width,height)
    name = turtle.textinput('昵称', '请输入你的昵称:')
    text = turtle.textinput('弹屏文字', '请输入弹屏文字:')
    content = '{}:{}'.format(name,text)
    mypen = turtle.Pen()
    mypen.hideturtle()
    mypen.pencolor('skyblue')
    mypen.penup()
    mypen.goto((width / 2), 0)
    mypen.pendown()
    # 弹屏移动
    i = 0
    while (i < width * 2):
        mypen.write(content,font=('文泉驿正黑',50))
        mypen.clear()
        mypen.backward(1)
        time.sleep(0.01)
        i = (i + 1)
turtle.done()

 

【提示】

部分含有Python第三方库相关内容的作品,在海龟编辑器网页端无法运行哦!如遇到这种情况,可以打开下面的链接,下载海龟编辑器客户端:

https://python.codemao.cn


回复

上一页1 页 / 共 0下一页