def offToggle0(self, event): if self.thd0: self.thd0.isOn = False self.thd0.isOff = True wx.PostEvent( self, myEvent_1.MyEvent_1(self.thd0, self, self.thd0ID, self.thd0.isOn, self.thd0.isOff)) self.thd0 = None self.t0.SetValue(str(0)) self.onBtn0.Enable() self.offBtn0.Disable()
def offToggle2(self, event): if self.thd2: self.thd2.isOn = False self.thd2.isOff = True wx.PostEvent( self, myEvent_1.MyEvent_1(self.thd2, self, self.thd2ID, self.thd2.isOn, self.thd2.isOff)) self.thd2 = None self.t2.SetValue(str(0)) self.onBtn2.Enable() self.offBtn2.Disable()
def offToggle3(self, event): if self.thd3: self.thd3.isOn = False self.thd3.isOff = True wx.PostEvent( self, myEvent_1.MyEvent_1(self.thd3, self, self.thd3ID, self.thd3.isOn, self.thd3.isOff)) self.thd3 = None self.t3.SetValue(str(0)) self.onBtn3.Enable() self.offBtn3.Disable()
def offToggle1(self, event): if self.thd1: self.thd1.isOn = False self.thd1.isOff = True wx.PostEvent( self, myEvent_1.MyEvent_1(self.thd1, self, self.thd1ID, self.thd1.isOn, self.thd1.isOff)) self.thd1 = None self.t1.SetValue(str(0)) self.onBtn1.Enable() self.offBtn1.Disable()
def run(self): try: print("Started Thread: " + str(self.ID)) while True: time.sleep(self.freq) if self.isOn: wx.PostEvent( self.parent, myEvent_1.MyEvent_1(self, self.parent, self.ID, self.isOn, self.isOff)) self.count += 1 except KeyboardInterrupt: print("Joining thread") self.join()