Programming Forums

Programming Forums (http://www.programmingforums.org/forumindex.php)
-   Python (http://www.programmingforums.org/forum43.html)
-   -   Keeping Window Open :\ (http://www.programmingforums.org/showthread.php?t=9130)

Xternal34 Mar 30th, 2006 5:46 PM

Keeping Window Open :\
 
K, I'm a complete noob when it comes to python. I have no experience in it what-so-ever. So you might be getting a lot of these posts from me... little lame things...

Now, how do you keep a python window open? When I do the print command, it doesn't stay open. Noobular, I know... but still. How?

jayme Mar 30th, 2006 6:20 PM

If python compilers are anything like c++, your program will execute then as soon as it's done, close. You can just ask for user input at the very end of your program, then it won't close.

If this isn't the problem you're having, my bad.

hydroxide Mar 30th, 2006 6:35 PM

Quote:

Originally Posted by Xternal34
Now, how do you keep a python window open? When I do the print command, it doesn't stay open. Noobular, I know... but still. How?

Assuming you're using windows, your python scripts are probably set up to run using <pythonw.exe>. If you run using <python.exe> instead, the window will need to be manually closed. Alternatively, run your script through IDLE or another IDE. Alternatively, make sure the last thing you do is raw_input("[MORE]").

-T.

Dietrich Mar 31st, 2006 11:16 AM

Without the last line shown
:

# bla blah blah code here

raw_input("Press enter to go on ...")

your program will close quickly even when you use python.exe (eg. double click on the filename.py in Windows XP)!
IDEs have their own output window and keep showing the result.

hydroxide Apr 2nd, 2006 9:22 PM

Quote:

Originally Posted by Dietrich
Without the last line shown... your program will close quickly even when you use python.exe (eg. double click on the filename.py in Windows XP)!

You're quite right. <boggle> I'm sure there was something that left CMD windows behind that needed to be manually closed, though - ??maybe in Win98?? - everything I've done in the last X years has been either through IDLE or pythonw.exe.

-T.


All times are GMT -5. The time now is 5:08 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC