[Tutor] seeing the results of a python program in windows7

Hugo Arts hugo.yoshi at gmail.com
Wed Mar 14 17:57:33 CET 2012


On Wed, Mar 14, 2012 at 5:12 PM, Tamar Osher <emeraldoffice at hotmail.com> wrote:
> Hi.  I ask for help.  Thanks very much for your time.
>
> I can run a python program in Notepad++, but what happens is that the black
> box flashes and disappears immediately, so that I never see the results.
>  How can I style it so that the results of the program stay on the computer
> screen, for me to see?
>

The black box disappears when the program exits. To stop your program
from exiting immediately, you can wait for user input at the end of
your program. In python 3, this is the input() function. In python 2
you should use raw_input().

Alternatively, you could add the lines

import os
os.system("pause")

at the end of the program, which asks you to press any key and then exits.
> Using IDLE, the Python Shell, I can click File/New Window, to get a new
> window that allows me to RUN a program.  But the RUN option does not allow
> me to choose which program I want to run.  How can I style it so that I can
> choose which program to run, and how can I see the results of that program?
>

If you want to use IDLE it's possible as well, and you don't need to
change your program for it. Just open the file you want to run in IDLE
(in the IDLE menu click File -> Open, or right click the file in
explorer and choose "Edit with IDLE") Then, either press F5 or click
Run -> Run Module.

HTH,
Hugo


More information about the Tutor mailing list