qt - Execute external *.exe application using Python and display output in real time -


let me introduce goal of application i'm building: creating front-end gui using pyside (qt) fortran based application used in framework of cfd. fortran application compiled *.exe file, and, when executed, continuously provides simulated lapse of time , other output details (when launch console, these data continously appear until finishes).

for example, if executed external code console get

>> mycfdapplication.exe    initializing...    simulation start...    time 0.2    time 0.4    time 0.6    time 0.8    time 1.0    simulation finished >> 

with quite long lapse of time between "time .." , next line.

the objective of gui generate initialization files external application, launch external application , provide user computation output information in real time (as plane text). other similar topics in site, have been able launch external application python using following code

import os, sys import subprocess  procexe = subprocess.popen("pru", shell=true, stdout=subprocess.pipe, stderr=subprocess.pipe, universal_newlines=true)  while procexe.poll() none: line = procexe.stdout.readline() print("print:" + line) 

but output displayed when execution finishes, , moreover, whole gui freezes until moment.

i know how launch external application using python, getting output in real time , passing gui instantaneously, if possible. idea print output in different lines inside "textedit" dialog using function "append(each_output_line)".

check out non-blocking read on subprocess.pipe in python , @ use of queues non-blocking read of subprocess. biggest change qt application going have use multiprocessing since, have observed, blocking in application going freeze gui.


Comments

Popular posts from this blog

1111. appearing after print sequence - php -

java - WARN : org.springframework.web.servlet.PageNotFound - No mapping found for HTTP request with URI [/board/] in DispatcherServlet with name 'appServlet' -

Ruby on Rails, ActiveRecord, Postgres, UTF-8 and ASCII-8BIT encodings -