I have a main window created with PyQt5, i.e.:
class PrincipalClass(QMainWindow):
def __init__(self):
super().__init__()
self.ui = Ui_PrincipalForm()
self.ui.setupUi(self)
self.list = []
self.filename = ""
self.chars = ""
self.filename_noext = ""
I have also a function inside the class:
def checkchars(self):
self.chars = ""
if self.ui.minuscoleCb.isChecked():
self.chars += self.minuscole
if self.ui.maiuscoleCb.isChecked():
self.chars += self.maiuscole
if self.ui.numeriCb.isChecked():
self.chars += self.numeri
Now I want to create a QThread class with his run function that I want to use in order to do some calculations, but I need to use inside the QThread class the result of self.chars coming from the main window.
class External(QThread):
word = pyqtSignal(str)
def run(self):
How can I have the value of self.chars available inside the QThread class? I know that from QThread to main window I can use the signal way, but viceversa?
question from:
https://stackoverflow.com/questions/65924992/qthread-and-data-coming-from-main-window 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…