On 30/01/12 05:20, Surya K wrote:
I want to run code until a "enter" is pressed. Well, it shouldn't wait
for the user to enter "enter"

This is my code:

import msvcrt

chr = 0
while chr != 'q':
print "my code",
if msvcrt.kbhit():
chr = msvcrt.getch()


You shouldn't need the kbhit test.
Try just using:

while ky != 'q':
   ky = msvcrt.getch()
   print ky


I am on windows. So, as msvcrt is for windows, I wonder if there is any
module that works for both,

Both what?


--
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/

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

Reply via email to