Home > other >  Turn to python redirect the output to Qt interface
Turn to python redirect the output to Qt interface

Time:09-21

I wrote a python invokes the qt interface, and then use OS. The system performs a CMD command, the CMD is to perform a c language to write the exe executable file, and executes a printf output to the terminal, how will these written content output to qt interface, the situation is that the print in python code are output to the qt interface, and the output of the exe or the terminal output in pycharm

No, I tried several different consist of OS. The popen, subproscess. Popen
I'm a python small white, only will write a small script
Big trouble to solve, or to provide solution

CodePudding user response:

Solution a:
Will print content of C language output to a file, read the contents of the file in qt again!
Special note: in [with OS. The system performs a CMD command, the CMD is to perform a c language to write the exe executable file] when needed synchronous processing, avoid file is not generated, QT begins to read!

Scheme 2:
Can study the pipeline pipe in the python module, realize interprocess communication problems!

CodePudding user response:

First of all thank you for your reply, one way I tried, but I've been running exe, if write a TXT, equivalent to content has been written, exe in the running process, the size of the TXT slowly in the change of qt to read like read less than content, how should I go to synchronization, scheme 2 is refers to the subprocess. Popen method? I now is to use this method, I create a thread to execute the code, this preliminary can satisfy I currently use, but the effect is not ideal,
  • Related