how to stop a loop with ESC key? [newbie]

Peter Hansen peter at engcorp.com
Tue Nov 8 20:49:56 EST 2005


mo wrote:
> "Fredrik Lundh"  wrote:
> 
>>works for me, when running it from a stock CPython interpreter in a
> 
> windows
> 
>>console window, with focus set to that window.
>>what environment are you using?
> 
> 
> I use IDLE 1.0.3, Python 2.3.4
> The same problem is when running in a win console.

And do you see the "." printing in the console window?

What do you get if you change the code so you print the getch() value?

e.g.

if msvcrt.kbhit():
     c = msvcrt.getch()
     print 'key', ord(c)

Does that ever print anything?

-Peter



More information about the Python-list mailing list