Topics

How to redirect process output to WinForm textbox in real-time?


Hailiang Shen
 

Hello all, I am trying to run a python3 script with .NET Process class. The python3 script runs slow and prints progress along the way, so I’d like to redirect the process prints to a WinFrom textbox.

 

My program includes a few threads:

Thread1 – generates a WinForm and puts it in Thread2

Thread2 – launches the python3 script in Thread3 using .NET Process class

Thread3 – redirects the process prints to a WinForm textbox (in Thread2) in real-time

 

I tried to Invoke the textbox Text update, .NET Mutex class but the process is always dumped at the end of the process but not in real-time.

 

Could you advise what else I may try? Thanks,

 

Hailiang