[Tutor] Where Does the DOS Window Come From?

Alan Gauld alan.gauld at btinternet.com
Wed Sep 24 19:51:13 CEST 2008


"Wayne Watson" <sierra_mtnview at sbcglobal.net> wrote

> When it's executed the expected GUI appears along with
> a DOS window. Occasionally, I think, I've seen something
> put in the DOS window.

The DOS window is the XP Command prompt execution
environment as used by the python interpreter,. Its where
the stdin, stdout and stderr streams appear by default.
Thus any print statements will appear there and any
raw_input requests will be read from there. You should eliminate
print or raw_input statements from a GUI if you want to
eliminate the DOS window.

> How do I stop it from appearing and how do I find why it's used?

To stop it appearing you need to run pythonw instead of python and the
easiest way to do that is change the extension from .py to .pyw
OTOH you may find it convenient for debugging to keep the DOS
window until everything is working as a place for debug/test print
statements to appear.

HTH,

-- 
Alan Gauld
Author of the Learn to Program web site
http://www.freenetpages.co.uk/hp/alan.gauld 




More information about the Tutor mailing list