用户:
heshi查看:0 回复:2 评论:0 创建时间:2021-08-01T22:30:48
【作品展示】

【作品介绍】
可以发送弹幕
【作品源代码】
import turtle
import time
myscreen = turtle.Screen()
myscreen.tracer(0) # 不展示当前窗口的绘制过程
width = 900
height = 400
myscreen.setup(width, height) # 设置当前窗口大小
name = myscreen.textinput("名称","请输入你的名称:")
text = myscreen.textinput("弹幕文字", "请输入弹幕内容:")
content = "{}: {}".format(name, text)
mypen = turtle.Pen()
mypen.pencolor("skyblue")
mypen.penup()
mypen.goto(width/2, 0)
mypen.pendown()
#mypen.write(content, font=("微软雅黑", 50))
# 弹幕移动
i = 0
while i < 2000:
mypen.write(content, font=("微软雅黑", 50))
mypen.backward(1)
time.sleep(0.01)
mypen.clear()
i += 1
turtle.done()
【提示】
部分含有Python第三方库相关内容的作品,在海龟编辑器网页端无法运行哦!如遇到这种情况,可以打开下面的链接,下载海龟编辑器客户端:
https://python.codemao.cn