Не могу понять что не так.
from PyQt4.QtCore import *
from PyQt4.QtGui import *
from Ui_form import *
class DoWebWork(QThread):
strSignal = pyqtSignal(str)
lblSignal = pyqtSignal(str)
def __init__(self, **args):
QThread.__init__(self)
def run(self):
self.myfunc()
def myfunc(self):
var1 = "Hello"
var2 = "Bye!"
self.strSignal.emit(var1)
self.lblSignal.emit(var2)
class MainForm(QMainWindow):
def __init__(self, parent=None):
QWidget.__init__(self, parent)
self.ui = Ui_MainForm()
self.ui.setupUi(self)
def pushButton_OnClick(self):
t = Worker()
t.start()
Worker.strSignal.connect(self.addToCombo)
Worker.lblSignal.connect(self.setLabel)
@pyqtSlot()
def setLabel(self, strTxt):
self.ui.myLabel.setText(strTxt)
@pyqtSlot()
def addToCombo(self, strName):
self.ui.comboBox.addItem(strName)
if __name__ == "__main__":
import sys
app = QApplication(sys.argv)
myapp = MainForm()
myapp.show()
sys.exit(app.exec_())