在 pygame 应用程序运行时弹出 Python 终端窗口 [英] Python terminal window popping up at pygame app run
问题描述
可能的重复:
如何隐藏在 Windows 上运行的 PyQt 应用程序中的控制台窗口?
当我在我的 pygame 应用程序 (.py) 上双击 Windows 时,所需的 pygame 窗口会打开,但始终伴随着它弹出一个空的终端窗口.我怎样才能防止这种情况?
When I double-click in Windows on my pygame app (.py) the desired pygame window opens, but always along with it, an empty terminal window pops up. How can I prevent this?
推荐答案
将文件的文件扩展名从 .py
更改为 .pyw
.
Change the file extension of your file from .py
to .pyw
.
2.2.2.可执行的 Python 脚本
2.2.2. Executable Python Scripts
Python 安装程序会自动将 .py
文件与 python.exe 相关联,以便双击 Python 文件将其作为脚本运行.扩展名也可以是.pyw
,在这种情况下,通常出现的控制台窗口被抑制.
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.
这篇关于在 pygame 应用程序运行时弹出 Python 终端窗口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!