在Windows下的wxPython中摆脱Python控制台 [英] Getting rid of Python console in wxPython under Windows

查看:721
本文介绍了在Windows下的wxPython中摆脱Python控制台的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


可能重复:

如何摆脱在Windows中运行wxPython程序时作为标准输出显示的控制台?

How to get rid of the console that shows up as standard output when running wxPython programs in Windows?

推荐答案

其他人已经建议从py重命名为pyw。
如果在创建wx.App类时改为引用Output重定向pass redirect = True。

Others have already suggested of renaming from py to pyw. If you instead refer to Output redirection pass redirect=True when creating the wx.App class.

请参见例如 http://www.wxpython.org/docs/api/wx.App-class.html

__ init __ 的签名为

__ init __(self,redirect = False,filename = None,useBestVisual = False,clearSigInt = True)

code> redirect = True 和文件名不同于None, sys.stdout sys.stderr 将被重定向到filename。请注意,在Windows和Mac重定向默认值为True。如果 redirect == True并且filename为None ,则输出将打印在与其他框架不同的弹出窗口中。
这可以是非常有用的,所以,在调试时,你可以跟踪发生了什么,而不是在发布模式下,你的应用程序的内部杂乱的用户界面。

If you set redirect=True and filename different from None, sys.stdout and sys.stderr will be redirect to filename. Note that on Windows and Mac redirect default value is True. If redirect==True and filename is None, the output will be printed in a popup window different from your other frames. This can be very useful so that while debugging you can follow what is happening, while not cluttering the user interface with the internals of your app in release mode.

这篇关于在Windows下的wxPython中摆脱Python控制台的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆