PyQt:Why a popup dialog prevents execution of other code?

That's exactly what the exec method of QDialog is designed for: modal dialogs. Read the "Modal" and "Modeless dialog" sections.

That's exactly what the exec method of QDialog is designed for: modal dialogs. Read the "Modal" and "Modeless dialog" sections. If you don't the dialog to block your main UI, call show() instead of exec() (and check the modal property documentation).

So with modal you cant interact with the main application and with modeless you can. I replaced exec() with show() but the popup appears and disappears in seconds,what else do I need to change? Thanks.

– evil_inside Dec 11 at 12:22 1 You need that object to stay alive as long as you need it. It probably needs to be a member of your class. I'm guessing it's getting destroyed when the function returns in your code (but I'm not very familiar with python).

– Mat Dec 11 at 12:24.

Ela The show() function immediately returns, and as dialog is local to this function, the object gets deleted as soon as "function_1" returns. You might want to make the dialog a member or global (whichever suits your requirement) so that the object stays in memory. HTH.

I went with the global option and it worked. One problem is that the dialog's windows appear,then the next function connected to the combobox executes and then the widgets inside the popup dialog appear. – evil_inside Dec 11 at 21:53.

Since you're setting the WA_DeleteOnClose window attribute, I'm assuming you want to create a new dialog every time the function_1 method is called (which is probably a good idea). If so, the simplest way to solve your issue (based on the code you've given), is to give your dialog a parent (so it is kept alive), and then display it modelessly using show(): def function_1(self): dialog = QDialog(self) dialog. Ui = Ui_Dialog_popup() dialog.ui.

SetupUi(dialog) dialog. SetAttribute(QtCore.Qt. WA_DeleteOnClose) dialog.show().

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions