我正在使用GTK为python中的命令行程序编写一个图形shell。主程序的输出如下:Starting Tractor:
Dec 04 22:10:34.000 [notice] Bootstrapped 0%: Starting
Dec 04 22:10:34.000 [notice] Bootstrapped 80%: Connecting to the Tor network
Dec 04 22:10:35.000 [notice] Bootstrapped 85%: Finishing handshake with first hop
Dec 04 22:10:36.000 [notice] Bootstrapped 90%: Establishing a Tor circuit
Dec 04 22:10:37.000 [notice] Bootstrapped 100%: Done
Tractor is conneted.
我有一个启动按钮,通过子进程启动程序。因为我希望主窗口在启动过程中是可操作的,所以我使用了trading。这是我的代码:
^{pr2}$
问题是日志输出不是实时的,但它要等到整个过程完成,然后再打印整个输出!在
我需要当时的实际百分比,以便将其传递给进度条,显示任务完成了多少。我怎么才能做到呢?在
编辑
由于theGtknerd,我修改了如下代码,但是feed函数在处理完成后仍然可以工作,只打印整个输出的第一行。我想这是一个故障,当IO\U-in被触发时。在
^{3}$