10/31
19:52
IT python

如何去除python执行时的黑色控制台窗口

在用python写用户界面的程序的时候,我们不希望控制台窗口的出现. 实际上python的用户文档里有说:

2.2.2. Executable Python Scripts
The Python installer automatically associates .py files with python.exe so that a double-click on a Python file will run it as a script. The extension can also be .pyw, in that case, the console window that normally appears is suppressed.

因此,我们只要简单地将后缀名.py改成.pyw就行了. :)

发表评论