Wxpython 停止wx.CallLater循环函数

Wxpython 停止wx.CallLater循环函数,wxpython,Wxpython,我有一个函数,它使用wx.CallLater每隔10秒调用另一个函数,直到返回的答案=6为止,该函数工作正常 我现在要做的是,如果需要的话,使用gui中的按钮,尽早打破这个循环 def confirmTimer(self): txid = utility.read_txid() confirms = utility.pConfirms(self.params['paddress']) if confirms < 6:

我有一个函数,它使用wx.CallLater每隔10秒调用另一个函数,直到返回的答案=6为止,该函数工作正常

我现在要做的是,如果需要的话,使用gui中的按钮,尽早打破这个循环

    def confirmTimer(self):
        txid = utility.read_txid()
        confirms = utility.pConfirms(self.params['paddress'])

        if confirms < 6:
            print "the timer has started"
            wx.CallLater(10000, self.confirmTimer) #increase to 10000 after testing

        self.confirm_count.SetLabel(str(confirms))
        self.cgauge.SetValue(int(confirms))
def确认计时器(自身):
txid=实用程序。读取\u txid()
确认=实用程序.pConfirms(self.params['paddress']))
如果确认<6:
打印“计时器已启动”
wx.CallLater(10000,self.confirmTimer)#测试后增加到10000
自我确认\计数设置标签(str(确认))
self.cgauge.SetValue(int(确认))

如果您将另一个变量设置为True,请将其添加到您的条件中,以便仅当您的现有条件和新条件都为True时,当您单击“您”按钮时,才会调用该变量将新变量更改为False