【发布时间】:2018-03-14 04:08:06
【问题描述】:
我正在尝试在窗口中创建文本输入效果,但它显示为 “TypeError:'Text' 对象不可迭代”。这是我当前的代码:
from graphics import *
import sys
from time import sleep
window = GraphWin('Test', 1000, 700)
text = Text(Point(500, 150), "This is just a test :P")
words = ("This is just a test :P")
for char in text:
sleep(0.1)
sys.stdout.write(char)
sys.stdout.flush()
word.draw(window)
如果我使用 'words' 变量,文本会出现在 shell 中,但是如果我尝试使用 text 变量,则会变成 TypeError。有没有办法让它可迭代?
【问题讨论】: