【发布时间】:2011-03-10 21:56:41
【问题描述】:
由于某种原因,TextCtrl 在无限循环中时不起作用,这是我的代码:
while 1:
localtime = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())
i = i + 1
#print str(i)
serRead = ser.readline()
serSplit = serRead.split(",")
#this works
print str(i)+', '+tempOrShock+', '+localtime+', '+serSplit[1]
#this doesn't
self.displayTextCtrl.WriteText(str(i)+', '+tempOrShock+', '+
localtime+', '+serSplit[1])
这个无限循环在按钮点击事件中,我基本上在点击按钮后运行无限循环,并告诉我的 TextCtrl 不断写出东西,但它不起作用。但是,打印语句工作正常。知道为什么会这样吗?
【问题讨论】:
标签: python user-interface wxpython infinite-loop