[Tutor] Problem with msvcrt
Ricardo Aráoz
ricaraoz at gmail.com
Wed Oct 31 14:21:53 CET 2007
Hi,
was just checking msvcrt module, tried a sample script :
>>> import time
>>> import msvcrt
>>> while True :
if msvcrt.kbhit() :
key = msvcrt.getch()
if key == 'h' :
print 'Hello'
if key == 'b' :
print 'Bye'
if key == '\r' : # <Enter>
break
else :
time.sleep(0.1)
< Now I keyboard 'h'..... nothing happens (an 'h' appears in idle) >
< keyboard 'b'...... nothing still (a 'b' appears) >
< keyboard <Enter>...... nothing >
< keyboard <Ctrl>+<c> and then :
Traceback (most recent call last):
File "<pyshell#16>", line 11, in <module>
time.sleep(0.1)
KeyboardInterrupt
hb
>>>
This is XP with 2.5 in Idle. Any ideas?
Thx
More information about the Tutor
mailing list