【发布时间】:2020-05-05 09:56:36
【问题描述】:
我很抱歉,但我是 PyGame 的新手,我希望能够在 PyGame 窗口中显示此文本动画。 (我顺便用repl.it)
在这个动画中,我不断打印新的文本行,这些文本被着色以产生双螺旋效果,并且我还使用“时间”功能使其在打印文本行之间等待以使其更可信
代码如下:
print(chr(27)+'[2j')
print('\033c')
print('\x1bc')
import colorful as cf
import time
while True:
print(cf.red(' 0'))
time.sleep(0.2)
print(cf.red(' 0' + cf.yellow(' 0')))
time.sleep(0.2)
print(cf.red(' 0' + cf.yellow(' 0')))
time.sleep(0.2)
print(cf.red(' 0' + cf.yellow(' 0')))
time.sleep(0.2)
print(cf.red(' 0' + cf.yellow(' 0')))
time.sleep(0.2)
print(cf.red(' 0' + cf.yellow(' 0')))
time.sleep(0.2)
print(cf.red(' 0' + cf.yellow(' 0')))
time.sleep(0.2)
print(cf.red(' 0' + cf.yellow(' 0')))
time.sleep(0.2)
print(cf.red(' 0' + cf.yellow(' 0')))
time.sleep(0.2)
print(cf.red(' 0' + cf.yellow(' 0')))
time.sleep(0.2)
print(cf.red(' 0' + cf.yellow(' 0')))
time.sleep(0.2)
print(cf.yellow(' 0'))
time.sleep(0.2)
print(cf.yellow(' 0' + cf.red(' 0')))
time.sleep(0.2)
print(cf.yellow(' 0' + cf.red(' 0')))
time.sleep(0.2)
print(cf.yellow(' 0' + cf.red(' 0')))
time.sleep(0.2)
print(cf.yellow(' 0' + cf.red(' 0')))
time.sleep(0.2)
print(cf.yellow(' 0' + cf.red(' 0')))
time.sleep(0.2)
print(cf.yellow(' 0' + cf.red(' 0')))
time.sleep(0.2)
print(cf.yellow(' 0' + cf.red(' 0')))
time.sleep(0.2)
print(cf.yellow(' 0' + cf.red(' 0')))
time.sleep(0.2)
print(cf.yellow(' 0' + cf.red(' 0')))
time.sleep(0.2)
print(cf.yellow(' 0' + cf.red(' 0')))
time.sleep(0.2)
【问题讨论】:
-
我不是你的领域,但问题不是很清楚。
标签: python animation pygame repl.it