Support Forums
Window closes when opened - Printable Version

+- Support Forums (https://www.supportforums.net)
+-- Forum: Categories (https://www.supportforums.net/forumdisplay.php?fid=87)
+--- Forum: Coding Support Forums (https://www.supportforums.net/forumdisplay.php?fid=18)
+---- Forum: Python Programming Language (https://www.supportforums.net/forumdisplay.php?fid=32)
+---- Thread: Window closes when opened (/showthread.php?tid=10500)



Window closes when opened - Reality - 08-04-2010

I used to know how to prevent this, but now I haven't used python forever and I have no idea Confused

Does anyone know how to stop it from closing?


RE: Window closes when opened - Daniel Faraday - 08-09-2010

You are double clicking the python file?
If so you are getting an error.

To stop it either use IDLE (The IDE that comes with Python) or run it through the command prompt.


RE: Window closes when opened - Reality - 08-10-2010

I found out a while ago, and yeah it was an error

But just for people who have problems with it closing right when it ends

Code:
import os
os.system("PAUSE")

makes it stay open until you close it


RE: Window closes when opened - Daniel Faraday - 08-11-2010

Or you could use raw_input("") so the user has to press enter afterward.


RE: Window closes when opened - Reality - 08-11-2010

Pause does the same thing?


RE: Window closes when opened - Daniel Faraday - 08-11-2010

If you put raw input you can close it by just pressing enter.
It's easier IMO.