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:
Question: is there any simple way to arrange to launch the app from
the desktop, without also launching a DOS box?
Just use the .pyw extension instead of .py, and the DOS box
automagically disappears -- or so I have been told ...
--
Leif Biberg Kristensen
http://solumslekt.org/
[Paul Rubin]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
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.
On 19 Apr 2005 20:49:56 -0700, Paul Rubin wrote:
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.
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