如何在python中隐藏控制台窗口? [英] How to hide console window in python?
本文介绍了如何在python中隐藏控制台窗口?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在Python中编写一个IRC bot。
I am writing an IRC bot in Python.
我想为Linux和Windows制作独立的二进制文件。主要是我希望当机器人启动时,控制台窗口应该隐藏,用户应该不能看到窗口。
I wish to make stand-alone binaries for Linux and Windows of it. And mainly I wish that when the bot initiates, the console window should hide and the user should not be able to see the window.
我能做什么? / p>
What can I do for that?
推荐答案
只需使用 .pyw
扩展名保存即可。这将阻止打开控制台窗口。
Simply save it with a .pyw
extension. This will prevent the console window from opening.
在Windows系统上,没有可执行模式的概念。 Python安装程序自动将.py文件与python.exe关联,以便双击Python文件将其作为脚本运行。 扩展程序也可以是.pyw,在这种情况下,通常显示的控制台窗口将被禁止。
这篇关于如何在python中隐藏控制台窗口?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文