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

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

Reply via email to