0

In my program, I run the execution of a Python script:

void analysis::on_pB_start_clicked()
{
    QString file = ui->lE_path->text();
    if (file.size() == 0)
    {
        QMessageBox::warning(this, "warning", "");
        return;
    }
    QProcess analyse;
    QString cArg;
    cArg="/tmp/pixmap.py -f " + file;
    analyse.start("python3 "+cArg);
    analyse.waitForFinished();
    analyse.close();
}

This process is running in the background and I can't track the execution time of this process.

Please tell me how I can track the execution of this script through the progressBar in Qt on the program form?

I think that in the Python script being run, me need to draw conclusions at some stage of the code, for example, Print ("1"), Print ("2"), and so on, and track these conclusions in your program and pass them to the progressBar, but these are just my assumptions... I could be wrong... please tell me how to act correctly and productively in this case.

And yet, when executing the above code, the program window freezes (waiting) for the duration of the execution of this script.

In the Python script, I use the matplotlib.pyplot library, and it is called there several times, several graphs are created and saved to a directory, which in the next I use these graphs in my Qt program.

Alex Rebell
  • 465
  • 3
  • 15

0 Answers0