I have QDialog designed by PyQt5 designer, I basically need to execute this dialog box from QMainWindow app in a separate process. Although I don't get any errors with below code but the Dialog box never show up. Can anyone tell me what am I doing wrong?
Main Window App on button click:
def alertWindow(self, alertInfo):
p = Process(name="alertwindow", target=alertWindowCustom, args=(alertInfo,))
Dialog Box Class:
class alertWindowCustom(QDialog, Ui_alertwindow):
def __init__(self, alertwindowData):
QDialog.__init__(self)
self.setupUi(self)
self.alertwindowData = alertwindowData
self.run()
self.exec_()
def run(self):
print("brah", self.alertwindowData)
If I just call alertWindowCustom
class as a = alertWindowCustom(alertInfo)
without a process, the dialog box is created but the MainWindow become unresponsive.
If using QThread
is a better option to use over multiprocessing
, I would rather use that.