Python wx(Python Card)将子进程输出日志到窗口
2 个回答
1
我也在寻找这个问题的解决办法。结果发现,解决方法其实非常简单:
proc = subprocess.Popen("任意程序", cwd="启动目录", shell=True,
stdout=subprocess.PIPE, stderr=subprocess.STDOUT )
while True:
txt = proc.stdout.readline()
if not txt: break
txt=txt.replace("\r\n","\n").replace("\r\n","\n").replace("\\","\")
self.components.taStdout.appendText(txt)