[Tutor] How to use getch()?
Dick Moores
rdm at rcblue.com
Sun Aug 27 18:30:51 CEST 2006
I'm trying to figure out how to change what a script does while it is
running, by pressing a key, such as "k". Can getch() be used for
this? As a first test:
==================
c = 0
while True:
c += 1
if getch() == "k":
break
print c
===================
This produces "NameError: name 'getch' is not defined".
Am I on the wrong track?
Thanks,
Dick Moores
Win XP, Python 2.43
More information about the Tutor
mailing list