import threading from PySide2.QtWidgets import * from PySide2.QtCore import * from PySide2.QtGui import * from ui.ui_Elaborate import Ui_Elaborate class Elaborate(Ui_Elaborate, QDialog): def __init__(self, mainWindow) -> None: super().__init__() self.setupUi(self) self.btn_OK.clicked.connect(self.click_ok) self.mainWin = mainWindow self.move(mainWindow.x()+(mainWindow.width()-self.width())/2,mainWindow.y()+(mainWindow.height()-self.height())/2) def click_ok(self): top = self.top_edit.text() bbox = self.checkBox.isChecked() thread = threading.Thread(target=self.mainWin.GUI.Elaborate, args=(top,bbox,)) thread.start() self.close()