Re: [Tutor] loop until a keypress

2012-01-30 Thread Steven D'Aprano
Surya K wrote: I am on windows. So, as msvcrt is for windows, I wonder if there is any module that works for both, http://code.activestate.com/recipes/577977 -- Steven ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription opt

Re: [Tutor] loop until a keypress

2012-01-30 Thread Christian Witts
On 2012/01/30 07:20 AM, 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() This isn't workin

Re: [Tutor] loop until a keypress

2012-01-30 Thread Alan Gauld
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 jus

Re: [Tutor] loop until a keypress

2012-01-30 Thread Peter Otten
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: This is what it looks like over here: > import msvcrtchr = 0while chr != 'q': print "my code", if > msvcrt.kbhit(): chr = msvcrt.getch() Th

[Tutor] loop until a keypress

2012-01-29 Thread Surya K
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 msvcrtchr = 0while chr != 'q': print "my code", if msvcrt.kbhit(): chr = msvcrt.getch() This isn't working the way I wanted. When ever I press enter, the