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

2012-03-15 Thread Brian van den Broek
On 15 Mar 2012 04:14, bob gailer bgai...@gmail.com wrote:

 On 3/14/2012 12:12 PM, Tamar Osher wrote:

 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?

 Do this:

 try:
   # your program goes here
 finally:
   raw_input(Press any key)
 # if you are running Python 3 replace raw_input with input

 Adding the try-finally construct ensures that any exception in your code
will be visible.


Alternatively, invoke python to run your program at the prompt with the
interactive switch:

  python -i myscript.py

Best,

Brian vdB
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


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

2012-03-14 Thread Tamar Osher

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?
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?






  ___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


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

2012-03-14 Thread Hugo Arts
On Wed, Mar 14, 2012 at 5:12 PM, Tamar Osher emeraldoff...@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
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


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

2012-03-14 Thread Mark Lawrence

On 14/03/2012 16:12, Tamar Osher 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?
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?

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Now that you can actually run a program, would you please be kind enough 
to tell everybody for the record how you overcame the problem I cannot 
run Python programs as asked in the thread entitled Cannot run python 
programs on my windows7 computer.


--
Cheers.

Mark Lawrence.

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


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

2012-03-14 Thread bob gailer

On 3/14/2012 12:12 PM, Tamar Osher 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.
If you expected anything else you don't understand how windows runs 
programs.
 How can I style it so that the results of the program stay on the 
computer screen, for me to see?

Do this:

try:
  # your program goes here
finally:
raw_input(Press any key)
# if you are running Python 3 replace raw_input with input

Adding the try-finally construct ensures that any exception in your code 
will be visible.


--
Bob Gailer
919-636-4239
Chapel Hill NC

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor