问题
I have one main window and one dialog in PYQT. I receive the input from user in main window and then open the dialog window and pass the input to this window.
in dialog window again I receive another input and add this new input with the other input which I passed form main window.
class MainWindow (QMainWindow):
def __init__(self):
super().__init__()
self.window=Ui_MainWindow()
self.window.setupUi(self)
def open_qdialog_window(self):
self.dialog_window = Qdialog(self.window.lineedit1.currentText())
self.dialog_window .show()
class Qdialog(QDialog):
def __init__(self,DS_parameter):
super().__init__()
self.DS_parameters=DS_parameters
#UI file of oscilloscope
self.window=Ui_Qdialog()
self.window.setupUi(self)
self.UI()
def summation(self):
self.DS_parameters=self.DS_parameters+self.window.lineedit2.currentText()
Now the question is how I can return self.DS_parameters to the main window and update editline1 with this new value?
来源:https://stackoverflow.com/questions/64343633/how-to-return-a-variable-from-another-window-in-pyqt