wx.Execute和wx.Process的问题,急!

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

wx.Execute和wx.Process的问题,急!

zinicl
用wx.Execute(self.edit_file_server.GetValue(), wx.EXEC_ASYNC, thread.processServer)启动了一个命令行程序,并且用
stream = self.processServer.GetInputStream()
if stream is not None and stream.CanRead():
 qslog = stream.read()
将标准输出捕获,经过测试发现输出不能及时被捕获,好像必须在缓冲满了以后才能被wxPython捕获,怎样才能使wxPython及时抓到这个命令行程序的输出?谢谢!

_______________________________________________
python-chinese
Post: send [hidden email]
Subscribe: send subscribe to [hidden email]
Unsubscribe: send unsubscribe to  [hidden email]
Detail Info: http://python.cn/mailman/listinfo/python-chinese
Reply | Threaded
Open this post in threaded view
|

Re: wx.Execute和wx.Process的问题,急!

A.TNG
为什么不用os.system() 或者 popen?


 
2008/1/25 zinicl <[hidden email]>:
用wx.Execute(self.edit_file_server.GetValue(), wx.EXEC_ASYNC, thread.processServer)启动了一个命令行程序,并且用
stream = self.processServer.GetInputStream()
if stream is not None and stream.CanRead():
 qslog = stream.read()
将标准输出捕获,经过测试发现输出不能及时被捕获,好像必须在缓冲满了以后才能被wxPython捕获,怎样才能使wxPython及时抓到这个命令行程序的输出?谢谢!

_______________________________________________
python-chinese
Post: send [hidden email]
Subscribe: send subscribe to [hidden email]
Unsubscribe: send unsubscribe to  [hidden email]
Detail Info: http://python.cn/mailman/listinfo/python-chinese



--
Best Regard,
Tang, Jiyu (Joey)
_______________________________________________
python-chinese
Post: send [hidden email]
Subscribe: send subscribe to [hidden email]
Unsubscribe: send unsubscribe to  [hidden email]
Detail Info: http://python.cn/mailman/listinfo/python-chinese
Reply | Threaded
Open this post in threaded view
|

Re: wx.Execute和wx.Process的问题,急!

zinicl
因为是异步,而且不想显示命令行窗口,捕获输出后,还要进一步加工才显示在界面上

在08-1-25,Joey <[hidden email]> 写道:
为什么不用os.system() 或者 popen?


 
2008/1/25 zinicl <[hidden email]>:
用wx.Execute(self.edit_file_server.GetValue(), wx.EXEC_ASYNC, thread.processServer)启动了一个命令行程序,并且用
stream = self.processServer.GetInputStream()
if stream is not None and stream.CanRead():
 qslog = stream.read()
将标准输出捕获,经过测试发现输出不能及时被捕获,好像必须在缓冲满了以后才能被wxPython捕获,怎样才能使wxPython及时抓到这个命令行程序的输出?谢谢!

_______________________________________________
python-chinese
Post: send [hidden email]
Subscribe: send subscribe to [hidden email]
Unsubscribe: send unsubscribe to  [hidden email]
Detail Info: <a href="http://python.cn/mailman/listinfo/python-chinese" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)"> http://python.cn/mailman/listinfo/python-chinese



--
Best Regard,
Tang, Jiyu (Joey)

_______________________________________________
python-chinese
Post: send [hidden email]
Subscribe: send subscribe to [hidden email]
Unsubscribe: send unsubscribe to   [hidden email]
Detail Info: <a onclick="return top.js.OpenExtLink(window,event,this)" href="http://python.cn/mailman/listinfo/python-chinese" target="_blank"> http://python.cn/mailman/listinfo/python-chinese


_______________________________________________
python-chinese
Post: send [hidden email]
Subscribe: send subscribe to [hidden email]
Unsubscribe: send unsubscribe to  [hidden email]
Detail Info: http://python.cn/mailman/listinfo/python-chinese
Reply | Threaded
Open this post in threaded view
|

Re: wx.Execute和wx.Process的问题,急!

LaiYonghao
stream.GetC()

在08-1-25,zinicl <[hidden email]> 写道:
因为是异步,而且不想显示命令行窗口,捕获输出后,还要进一步加工才显示在界面上

在08-1-25,Joey <[hidden email]> 写道:
为什么不用os.system() 或者 popen?


 
2008/1/25 zinicl <[hidden email]>:
用wx.Execute(self.edit_file_server.GetValue(), wx.EXEC_ASYNC, thread.processServer)启动了一个命令行程序,并且用
stream = self.processServer.GetInputStream()
if stream is not None and stream.CanRead():
 qslog = stream.read ()
将标准输出捕获,经过测试发现输出不能及时被捕获,好像必须在缓冲满了以后才能被wxPython捕获,怎样才能使wxPython及时抓到这个命令行程序的输出?谢谢!

_______________________________________________
python-chinese
Post: send [hidden email]
Subscribe: send subscribe to [hidden email]
Unsubscribe: send unsubscribe to  [hidden email]
Detail Info: <a onclick="return top.js.OpenExtLink(window,event,this)" href="http://python.cn/mailman/listinfo/python-chinese" target="_blank">http://python.cn/mailman/listinfo/python-chinese



--
Best Regard,
Tang, Jiyu (Joey)

_______________________________________________
python-chinese
Post: send [hidden email]
Subscribe: send subscribe to [hidden email]
Unsubscribe: send unsubscribe to   [hidden email]
Detail Info: <a onclick="return top.js.OpenExtLink(window,event,this)" href="http://python.cn/mailman/listinfo/python-chinese" target="_blank">http://python.cn/mailman/listinfo/python-chinese


_______________________________________________
python-chinese
Post: send [hidden email]
Subscribe: send subscribe to [hidden email]
Unsubscribe: send unsubscribe to  [hidden email]
Detail Info: <a onclick="return top.js.OpenExtLink(window,event,this)" href="http://python.cn/mailman/listinfo/python-chinese" target="_blank">http://python.cn/mailman/listinfo/python-chinese


_______________________________________________
python-chinese
Post: send [hidden email]
Subscribe: send subscribe to [hidden email]
Unsubscribe: send unsubscribe to  [hidden email]
Detail Info: http://python.cn/mailman/listinfo/python-chinese
Reply | Threaded
Open this post in threaded view
|

Re: wx.Execute和wx.Process的问题,急!

zinicl
嗯,终于搞定,不关wxpython的事情,在命令行程序中加上setbuf(stdout, NULL)就OK

_______________________________________________
python-chinese
Post: send [hidden email]
Subscribe: send subscribe to [hidden email]
Unsubscribe: send unsubscribe to  [hidden email]
Detail Info: http://python.cn/mailman/listinfo/python-chinese