[Tutor] running python script

Alan Gauld alan.gauld at btinternet.com
Sun Aug 10 23:30:03 CEST 2008


"r t" <rt8396 at gmail.com> wrote

> this works, but the problem is the commad prompt stays open in the
> background cluttering up my desktop.
> So,
> 1. How do i close the command prompt after starting my program???

You don't. Instead you arrange for it not to open in the first place!

The trick is to run the program using pythonw.exe which is associated
with files ending .pyw.

Thus rename your TextEdit.py to TextEdit.pyw and all should be well!

> here is my one line batch script:
> C:\Python25\python.exe C:\Python25\TextEditor.py %1

Or in this case substitute pythonw.exe for python.exe

But to save trouble when you upgrade python I'd do two things:
1) move your textedit,py file into another folder not under python.
2) rename the file .pyw as above
3) replace the line above with START /B textedit.pyw

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