Alan Gauld has also been trying to help me by direct email. But his suggested

=========================
import msvcrt
c = 0
while True:
     c += 1
     if msvcrt.kbhit():
        if msvcrt.getch() == 'k':
            break
     else: continue
print c
====================

didn't work for me either. I was just about to tell him so, when I 
remembered to try to run it not using IDLE, i.e., by just clicking on 
the script icon (to use the console--is that the term?)  I knew I'd 
have to add a line something like

raw_input("\n\nPress the enter key to exit.")

and when I did the script ran just as I'd hoped!

My thanks to Kent and Alan.

Dick Moores

_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to