如何在Windows中运行Python而无需弹出DOS框? [英] How to run Python in Windows w/o popping a DOS box?

查看:452
本文介绍了如何在Windows中运行Python而无需弹出DOS框?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

来自Windows无知的愚蠢问题:


我发现自己需要编写一个Python应用程序(称之为myapp.py)

使用tkinter,因为它必须在(ü)Windows下使用。

如果它有任何区别那就是Windows XP。


我放了一个快捷方式到桌面上的myapp.py,它显示为一个很小的绿蛇图标,非常酷和Pythonic。当我按
双击图标时,应用程序启动就好了,而tkinter

界面就可以了。但Windows也推出了一个DOS盒子,它只是毫无用处地放在屏幕上。这可能对

" print"有用。 Python应用程序中的语句可以在DOS框中显示消息,

但我认为这是一个图形应用程序,所以我不打算以这种方式显示消息

。而且,碰巧我经常想要同时运行大量的应用程序的实例,并且我想通过点击图标来双启动它们。\\ b
。这意味着整个屏幕上都堆满了DOS

盒子。当然,我可以通过点击每个角落里的小下划线来最小化它们,但这真的需要

远离它的凉爽。


问题:是否有任何简单的方法可以安排从桌面启动应用程序,而不需要启动DOS框?通过简单我的意思是

而不必乱用一些复杂的包装/安装系统

(McMillan安装程序?)每次我想要修改应用程序,其中
开发期间
意味着每天几百次。我根本没有希望

隐瞒用户的源代码或类似的东西




谢谢。

Dumb question from a Windows ignoramus:

I find myself needing to write a Python app (call it myapp.py) that
uses tkinter, which as it happens has to be used under (ugh) Windows.
That''s Windows XP if it makes any difference.

I put a shortcut to myapp.py on the desktop and it shows up as a
little green snake icon, which is really cool and Pythonic. When I
double click the icon, the app launches just fine and the tkinter
interface does its thing. But Windows also launches a DOS box that
just sits on the screen uselessly. It''s potentially useful in that
"print" statements in the Python app can show messages on the DOS box,
but I figure this is a graphical app so I don''t plan to show messages
that way. Also, it happens I often want to run lots of instances of
the app simultaneously, and I want to launch them all by double
clicking the icon. That means the whole screen is cluttered with DOS
boxes all over the place. Of course I can minimize them by clicking
the little underscore in the corner of each one, but that really takes
away from the coolness of it all.

Question: is there any simple way to arrange to launch the app from
the desktop, without also launching a DOS box? By simple I mean
without having to mess with some complex packaging/installation system
(McMillan installer?) every time I want to modify the app, which
during development means a few hundred times a day. I have no desire
at all to conceal the source code from the user or anything like that
either.

Thanks.

推荐答案

Paul Rubin skrev:
Paul Rubin skrev:
问题:是否有任何简单的方法来安排启动应用程序来自桌面,还没有启动DOS框?
Question: is there any simple way to arrange to launch the app from
the desktop, without also launching a DOS box?




只需使用.pyw扩展名而不是.py和DOS框

自动消失 - 或者我被告知......

-

Leif Biberg Kristensen
http://solumslekt.org/


[Paul Rubin]
[Paul Rubin]

我发现自己需要编写一个使用tkinter的Python应用程序(称之为myapp.py),因为它发生了在(呃)Windows下使用。
这是Windows XP,如果有的话 区别。


不,Windows风味无所谓。

我在桌面上放了一个myapp.py的快捷方式,它显示为界面就可以了。但是Windows也会启动一个DOS框,它只是无用地放在屏幕上。


....


问题:有没有简单的方法来安排从桌面启动应用程序,没有还推出了DOS盒子? ...
从DOS框中,
Dumb question from a Windows ignoramus:

I find myself needing to write a Python app (call it myapp.py) that
uses tkinter, which as it happens has to be used under (ugh) Windows.
That''s Windows XP if it makes any difference.
Nope, the Windows flavor doesn''t matter.
I put a shortcut to myapp.py on the desktop and it shows up as a
little green snake icon, which is really cool and Pythonic. When I
double click the icon, the app launches just fine and the tkinter
interface does its thing. But Windows also launches a DOS box that
just sits on the screen uselessly.
....

Question: is there any simple way to arrange to launch the app from
the desktop, without also launching a DOS box? ... From a DOS box,




ren myapp.py * .pyw


并点击改为生成myapp.pyw的链接。这是Windows上.pyw扩展名的

目的,而不是打开一个DOS框。

..pyw与Windows特定的关联pythonw.exe。



ren myapp.py *.pyw

and click on a link to the resulting myapp.pyw instead. It''s the
purpose of the .pyw extension on Windows not to "bring up a DOS box".
..pyw is associated with the Windows-specific pythonw.exe.


2005年4月19日20:49:56 -0700,Paul Rubin< http://ph****@NOSPAM.invalid>写道:
On 19 Apr 2005 20:49:56 -0700, Paul Rubin <http://ph****@NOSPAM.invalid> wrote:
来自Windows无知的愚蠢问题:

我发现自己需要编写一个Python应用程序(称之为myapp.py)
使用tkinter,因为它必须在(ugh)Windows下使用。
这是Windows XP,如果它有任何区别。

我在myapp.py上放了一个快捷方式桌面它显示为一个小绿蛇图标,这真的很酷和Pythonic。当我双击图标时,应用程序启动就好了,tkinter
界面就可以了。但是Windows也会启动一个DOS框,它只是无用地放在屏幕上。它可能在
print中有用。 Python应用程序中的语句可以在DOS框中显示消息,
但我认为这是一个图形应用程序,所以我不打算以这种方式显示消息。此外,我经常想要同时运行大量的应用程序实例,我想通过双击启动它们
点击图标。这意味着整个屏幕上都装满了DOS
盒子。当然,我可以通过点击每个角落里的小下划线来最小化它们,但这真的需要远离它的凉爽。

问题:有没有任何简单的方法来安排从桌面启动应用程序,而不是启动DOS框?简单来说我的意思是
每次我想要修改应用程序时都不必乱用一些复杂的包装/安装系统(McMillan安装程序?),这在开发过程中意味着几百次天。我根本不想隐藏用户或类似的源代码。

谢谢。
Dumb question from a Windows ignoramus:

I find myself needing to write a Python app (call it myapp.py) that
uses tkinter, which as it happens has to be used under (ugh) Windows.
That''s Windows XP if it makes any difference.

I put a shortcut to myapp.py on the desktop and it shows up as a
little green snake icon, which is really cool and Pythonic. When I
double click the icon, the app launches just fine and the tkinter
interface does its thing. But Windows also launches a DOS box that
just sits on the screen uselessly. It''s potentially useful in that
"print" statements in the Python app can show messages on the DOS box,
but I figure this is a graphical app so I don''t plan to show messages
that way. Also, it happens I often want to run lots of instances of
the app simultaneously, and I want to launch them all by double
clicking the icon. That means the whole screen is cluttered with DOS
boxes all over the place. Of course I can minimize them by clicking
the little underscore in the corner of each one, but that really takes
away from the coolness of it all.

Question: is there any simple way to arrange to launch the app from
the desktop, without also launching a DOS box? By simple I mean
without having to mess with some complex packaging/installation system
(McMillan installer?) every time I want to modify the app, which
during development means a few hundred times a day. I have no desire
at all to conceal the source code from the user or anything like that
either.

Thanks.



我会尝试右键单击快捷方式图标并选择属性,

然后选择快捷方式选项卡并使用s / python / pythonw /

编辑目标字符串,然后单击确定。


然后尝试再次双击快捷方式图标。

如果这样做,你就回家了;-)

如果没有,请发布更多症状。

HTH


问候,

Bengt Richter


I would try right-clicking the shortcut icon and selecting properties,
then select the shortcut tab and edit the target string with s/python/pythonw/
and then click ok.

Then try double clicking the shortcut icon again.
If that does it, you''re home ;-)
If not, post more symptoms.
HTH

Regards,
Bengt Richter


这篇关于如何在Windows中运行Python而无需弹出DOS框?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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