class mainThread(threading.Thread): def __init__(self, filename): super(mainThread, self).__init__() self.isStop = False self.filename = filename self.q = QQ() def run(self): def runQQ(filename): self.q.run(filename) subthread = threading.Thread(target=runQQ, args=(self.filename,)) subthread.setDaemon(True) subthread.start() print u'子线程开始' # while True: # if self.getQQ()!=None: # # break def stop(self): print 'stop' self.isStop = True def getQQ(self): print 'getQQ' return self.q.getQQnumber()
def __init__(self, filename): super(mainThread, self).__init__() self.isStop = False self.filename = filename self.q = QQ()