我有一个很常见的问题但对我来说并不容易。
我正在尝试将CheckExcel
类的PyQt信号连接到class CheckExcel(QtCore.QThread):
updated = QtCore.pyqtSignal(int)
updateLab = QtCore.pyqtSignal(str)
running = False
def __init__(self, parent=None):
super(CheckExcel, self).__init__(parent)
self.progPercent = 0
self.running = True
def run(self):
pythoncom.CoInitialize()
try:
while self.running == True:
self.updated.emit(int(self.progPercent))
self.updateLab.emit(str(va_TC))
print(self.progPercent)
except :
print('Excel is not executed')
CheckExcel().run()
class MainWindow(QtWidgets.QMainWindow):
def __init__(self, parent=None):
super(MainWindow, self).__init__(parent=parent)
self.setupUi(self)
def startBtnClicked(self):
self.chk_excel = CheckExcel(self)
self.chk_excel.start()
self.chk_excel.updated.connect(self.updateValue)
self.chk_excel.updateLab.connect(self.updateLabel)
def updateValue(self, data):
self.progressBar.setValue(data)
def updateLabel(self, text):
self.label.setText(text)
def stop(self):
self.event.set()
if __name__ == "__main__":
app = QtWidgets.QApplication(sys.argv)
w = MainWindow()
w.show()
sys.exit(app.exec_())
类,但它不起作用。我想有些人知道如何做到这一点,但有些人却不知道。大多数不知道的人指出了代码...但请不要这样做。我的观点是我怎么能连接它?
以下是一些代码:
Array
(
[read_only] =>
[revision] => 128
[bytes] => 0
[thumb_exists] =>
[rev] => 80527cbf3f
[modified] => Tue, 03 Jan 2017 05:09:35 +0000
[size] => 0 bytes
[path] => /Unfiled Documents
[is_dir] => 1
[modifier] =>
[root] => dropbox
[icon] => folder
)
1