"Paul Whittaker" <paul.whittake...@ntlworld.com> wrote

Using the following script, the (Windows 7) PC echoes the key presses but
doesn't quit (ever!)

import msvcrt
print('Press SPACE to stop...')
while True:
   k = msvcrt.getch()     # Strangely, this echoes to the IDLE window

You will need to run it in an OS command window not in IDLE.
Idle does its own keystoke capturing since its a GUI.

I'll need to add a note to my tutor page to emphasise that since
its probably not intuitively obvious! :-)


Alan G.

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

Reply via email to