无法在线程中获取我的重复计时器的返回值

时间:2019-12-11 22:07:11

标签: python multithreading timer

我一直在尝试获取我的LoopyTimer的返回值,它基本上只是一个线程计时器的模块。我确实知道我的代码是错误的,但是我真的不确定如何获取返回值,但我做不到。这是我的python代码:

    def test(self):
        bamz = LoopyTimer(5.0, self.joe)
        bamz.start()
        sleep(3)
        while True:
            if not bamz.running:
                print(bamz)

    def joe(self):
        print("Hi")
        print("This is a test")
        sleep(5)
        return "test"
    ```

0 个答案:

没有答案