【发布时间】:2013-02-19 22:33:13
【问题描述】:
我正在制作一个 wxPython 应用程序,我需要每 15 秒从 Internet 更新一个值。有什么方法可以让我有一个函数来设置值,并让它在这个时间间隔在后台运行,而不会中断程序?
编辑:这是我正在尝试的:
import thread
class UpdateThread(Thread):
def __init__(self):
self.stopped = False
UpdateThread.__init__(self)
def run(self):
while not self.stopped:
downloadValue()
time.sleep(15)
def downloadValue():
print x
UpdateThread.__init__()
【问题讨论】:
标签: python multithreading timer wxpython