Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def test():
- for x in range(100):
- print(x)
- print("python code !!!!")
- test()
- void SettingsWindow::on_pushButton_2_clicked()
- {
- QProcess process;
- QString scriptFile = QCoreApplication::applicationDirPath() + "/Users/wouterlefebvre/GithubRepos/Hello.py";
- QString pythonCommand = "python " + scriptFile;
- process.start (pythonCommand);
- QProcess *myProcess = new QProcess();
- myProcess->startDetached("python.exe "/Users/wouterlefebvre/GithubRepos/Hello.py" );
- myProcess->start();
- //check that the process actually starts
- if (!myProcess->waitForStarted()) {
- qDebug("Could not start process");
- return;
- }
- QTime time;
- time.start();
- //wait 4 seconds
- while (time.elapsed() < 4000) {
- //keep the GUI working
- QApplication::processEvents();
- }
- myProcess->kill();
- // wait for the process to actually stop
- myProcess->waitForFinished();
- delete myProcess;
- }
Add Comment
Please, Sign In to add comment