[PyQt] Show QDialog and execute code after

Ricardo Araoz ricaraoz at gmail.com
Sat Apr 14 20:46:43 BST 2018


On 14/04/18 15:46, Kyle Altendorf wrote:
> On April 14, 2018 2:01:36 PM EDT, Maurizio Berti <maurizio.berti at gmail.com> wrote:
>>> I making an update app that shows a QTextEdit object and starts
>> (should)
>> start to get information from the system before
>>> ask the user what to do, it does that but if now but only after the
>> function get all the system info and the it draws the QDialog.
>>> It's something like a Debian apt-get where the terminal is showing
>> what
>> is appending before and after each operation.
>>
>> If that's the case, you should use a separate QObject that collects the
>> output of apt-get and emits a signal every time it has something to
>> show.
>> That QObject has to be moved to a new QThread, so that the apt-get
>> process
>> will not block the GUI interaction and painting.
> Or avoid threads and use QProcess if it is actually a case of subprocessing. The good answer really depends on the actual long running activity. Could be processEvents() or QProcess or even Twisted or such (or occasionally threading).
>
> Cheers,
> -kyle
>

Agree, the easiest technique that produces the desired result.



More information about the PyQt mailing list