[PyQt] Show QDialog and execute code after
Kyle Altendorf
sda at fstab.net
Fri Apr 13 12:30:35 BST 2018
On 2018-04-13 07:00, Starglider Developer wrote:
> Hi, I need after the QDialog is show, to run code and display the
> output to a QTextEdit. Now I can only run the code with the QDialog
> with user input -a QPushButton- If the code runs inside the
> def __init__(self, parent=None):
It helps to see the full code. Also, it's often good to be able to
construct objects without them actually doing things and have the
activities in a separate method.
> the QDialog is not shown until it finish the code execution.
I'll guess you are using QDialog.exec() which blocks until the user
closes the dialog.
http://doc.qt.io/qt-5/qdialog.html#exec
The .show() call doesn't block but you will have to get the result of
the dialog via it's signals or the .result() method.
http://doc.qt.io/qt-5/qwidget.html#show
http://doc.qt.io/qt-5/qdialog.html#result
Or, perhaps you can just move the other code so it is before the .exec()
call for the dialog? It really depends what all you have going on.
Cheers,
-kyle
More information about the PyQt
mailing list