如何摆脱“命令行"使用 GUI 运行 Python 脚本时的窗口? [英] How to get rid of "Command Line" window when running Python script with GUI?

查看:86
本文介绍了如何摆脱“命令行"使用 GUI 运行 Python 脚本时的窗口?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

可能的重复:
如何隐藏在 Windows 上运行的 PyQt 应用程序中的控制台窗口?

本人在Python2.6+PyQT+Eric4环境下编程.所有的 GUI 和程序部分都完成了,但这里是问题所在.当我运行我的程序时,会弹出两个窗口.一个是我想要的窗口(或框架),另一个就像一个具有全黑地下颜色的 python 解释器窗口.而且我真的不想显示这个.

I am programming under Python2.6 + PyQT + Eric4 environment. All the GUI and Program parts are done, but here is the problem. When I run my program, two windows pop up. One is the window (or frame) I want, the other is like a python interpretor window having a all black undergroud color. And I really don't want this to show.

我该怎么做才能摆脱它?请帮我解决这个问题.

What can I do to get rid of it? Please help me out of this.

推荐答案

我想您使用的是 Windows,这是我所知道的唯一一个在您双击脚本时会打开提示的操作系统.AFAIK 有两种解决方案:按照@Adrien 的建议,使用 pythonw.exe 可执行文件执行文件.如果您使用.pyw 扩展名保存文件,Windows 会在您双击时自动使用pythonw.exe 来执行脚本

I suppose you are using Windows, the only operating system I know to open a prompt when you double click a script. There are two solutions AFAIK: execute the file with the pythonw.exe executable, as suggested by @Adrien. If you save the file with the .pyw extension, Windows automatically uses pythonw.exe for executing the script when you double click

这篇关于如何摆脱“命令行"使用 GUI 运行 Python 脚本时的窗口?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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