2016-05-23 88 views
0

這只是我的代碼的一部分。當我點擊btn_convertbtn_save functionself.convertThread.startself.convert_and_save)工作。但是當我點擊btn_convert_save,只能工作self.open。問題是,爲什麼點擊btn_convert_save後不能啓動全部3個功能?如何在單擊按鈕上運行3(帶線程)功能?

class Window(QtGui.QMainWindow): 

def __init__(self): 
    super(Window, self).__init__() ... 
def home(self): 
    self.saveThread = SaveThread() 
    self.convertThread = ConvertThread() 
    btn_convert.clicked.connect(self.convertThread.start) 
    btn_save.clicked.connect(self.saveThread.start) 
    btn_convert_save.clicked.connect(self.convert_and_save) ... 

def convert_and_save(self): 
    self.open() 
    self.convertThread.start 
    self.saveThread.start 
    #self.convert() 
    #self.save_file() 

class SaveThread(QtCore.QThread): 
def __init__(self): 
    super(SaveThread, self).__init__() 

def run(self):... 

class ConvertThread(QtCore.QThread): 
def __init__(self): 
    super(ConvertThread, self).__init__() 

def run(self):... 

回答

0

你忘了括號,而不是

self.convertThread.start 

self.convertThread.start()