<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body text="#000000" bgcolor="#FFFFFF">
On 13/04/18 08:00, Starglider Developer wrote:<br>
<blockquote type="cite"
cite="mid:CAJdNm3-k1h9RrKerSbLNzFAf=1ca56d+=HKSg1Z3wAmaMVkWNw@mail.gmail.com">
<div dir="ltr">
<div>
<div>
<div>
<div>
<div>Hi,<br>
</div>
I need after the QDialog is show, to run code and
display the output to a QTextEdit.<br>
</div>
Now I can only run the code with the QDialog with user
input -a QPushButton-<br>
</div>
If the code runs inside the<br>
<span style="font-family:monospace,monospace">def
__init__(self, parent=None):</span><br>
<br>
the QDialog is not shown until it finish the code execution.<br>
<br>
</div>
I'm using Python 2.7 and PyQt4.<br>
<br>
</div>
Thank you in advance.<br>
</div>
<br>
</blockquote>
<br>
You might try putting the slow code inside a method, then in the
__init__() method you instantiate your QTextEdit without data, then
use QTimer.singleShot(0, self.yourSlowCode) inside which you'll be
actualizing the QTextEdit as you have the data available. I think
the singleShot will execute yourSlowCode() as soon as the window's
event queue is processed, that means the widget will appear in the
screen and take user input. Worth a try.<br>
Check : <a class="moz-txt-link-freetext" href="http://doc.qt.io/qt-5/qtimer.html">http://doc.qt.io/qt-5/qtimer.html</a> look for "special case"
inside the "Detailed Description".<br>
<br>
<br>
<br>
</body>
</html>