import sys,time
import threading
from PyQt5 import QtWidgets,QtCore,QtGui
import zuoye2
import socket
class Mywindow(QtWidgets.QMainWindow, zuoye2.Ui_MainWindow):
def __init__(self):
super(Mywindow,self).__init__()
self.setupUi(self) #继承于Ui_MainWindow
self.pushButton.clicked.connect(self.zuoxian)
self.pushButton_2.clicked.connect(self.youxian)
def zuoxian(self):
a=threading.Thread(target='zuo')
a.start()
def zuo(self):
for i in range(1,10,1):
time.sleep(1)
self.textEdit.append(str(i))
def you(self):
for i in range(1, 10, 1):
self.textEdit_2.append(str(i))
def youxian(self):
a=threading.Thread(target='you')
a.start()
我写的pyqt代码 ,想让zuoxian开线程,绑定函数zuo,但是报错,如图所示:
我觉得是target=后面加了引号的问题,把引号去掉后,target=后面的那个参数又出现了下滑红曲线,好难过,求大佬们解答