from threading import Timer
class test_timer():
def __init__(self):
self.awesum="hh"
self.timer = Timer(1,self.say_hello,args=["WOW"])
def say_hello(self,message):
self.awesum=message
print 'HIHIHIIHIH'
print message
raise Exception("hi")
if __name__ == '__main__':
print 'Got to main'
x=test_timer()
当我运行上面的代码时,我的回调方法永远不会被触发。我已经尝试解决这个问题好几个小时了,但还是想不出来>;<
为了测试,计时器。我运行此代码并检查x.awesum是否为“WOW”
你从不启动计时器。你需要:
相关问题 更多 >
编程相关推荐