Suppressing console on Windows?

Guido van Rossum guido at cnri.reston.va.us
Tue Oct 12 19:11:59 EDT 1999


edlsoft at mindspring.com (Burt Leavenworth) writes:

> On Mon, 11 Oct 1999 14:19:04 +1000, "Brian Blackwell"
> <blackers at netscape.net> wrote:
> 
> >My apologies if this is a FAQ, but is there a way to prevent the text
> >console appearing when running a Tkinter-based Python script on Windows?
> >
> >Thanks in advance
> >Brian Blackwell
> >
> >
> One solution that works for me is the following:
> Say your script is test.py
> set up a batch file, say xtest.bat:
>    @echo off
>    python test.py
> 
> Go to Windows Explorer and right click on xtest.bat, click Properties,
> select Program tab, select 'minimized' in Run: box, and check 'Close
> on exit'
> Then at the desktop, click Start, Run and type: c:xtest
> The DOS box should not appear.

Actually, the "pythonw.exe" interpreter (with a "w" in its name) is
intended for this.  If you name your script "test.pyw" it will
automatically run pythonw when you double click the script.  Note that
if there is an error you will see nothing; the best thing to do is to
rename the script to "test.py" or drop the "test.pyw" file on the
"python.exe" (without "w" in its name).

--Guido van Rossum (home page: http://www.python.org/~guido/)




More information about the Python-list mailing list