<HTML><HEAD>
<META charset=US-ASCII http-equiv=Content-Type content="text/html; charset=US-ASCII">
<META content="MSHTML 6.00.2800.1400" name=GENERATOR></HEAD>
<BODY style="FONT-SIZE: 10pt; FONT-FAMILY: Arial; BACKGROUND-COLOR: #ffffff">
<DIV>Hello all,</DIV>
<DIV> </DIV>
<DIV>I was trying to set up a 'press any key to exit' mini-program similar to the one described here: <A href="http://www.freenetpages.co.uk/hp/alan.gauld/tutor2/tutevent.htm">http://www.freenetpages.co.uk/hp/alan.gauld/tutor2/tutevent.htm</A>, but there seemse to be an issue with msvcrt.getch() on my computer (Windows XP Home, Python Version 2.3.4 final, IDLE version 1.0.3) when I ran it on IDLE. When I just type [msvcrt.getch()] at the prompt, it returns '\xff' as shown below:</DIV>
<DIV> </DIV>
<DIV>>>> msvcrt.getch()<BR>'\xff'</DIV>
<DIV> </DIV>
<DIV>This means that when I try running the script described at the above website, a space does squat, as demonstrated below:</DIV>
<DIV> </DIV>
<DIV>>>> </DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV>Hit space to end...</DIV>
<DIV> </DIV>
<DIV>255<BR> 255<BR>255<BR> 255<BR>255<BR> 255<BR> 255<BR>255<BR>255<BR> 255</DIV>
<DIV>... ##until i hit Control-C</DIV>
<DIV>Traceback (most recent call last):<BR> File "C:/Documents and Settings/Cookie/Desktop/try.py", line 32, in ?<BR> doKeyEvent(key)<BR> File "C:/Documents and Settings/Cookie/Desktop/try.py", line 9, in doKeyEvent<BR> print ord(key)<BR> File "C:\PROGRA~1\lib\idlelib\PyShell.py", line 1128, in write<BR> self.shell.write(s, self.tags)<BR> File "C:\PROGRA~1\lib\idlelib\PyShell.py", line 1117, in write<BR> raise KeyboardInterrupt<BR>KeyboardInterrupt</DIV>
<DIV> </DIV>
<DIV>The spaces before the '255' are points when i tried to exit using a space. A minor detail about the script at the site: it doesn't work as is, so i added a colon after the if-else lines in the first module and changed all references to 'ky' to 'key' for consistency. Any ideas as to why this doesn't work?</DIV>
<DIV> </DIV>
<DIV>Thanks in advance, </DIV>
<DIV>Orri</DIV>
<DIV> </DIV>
<DIV>P.S.: I just had a thought that perhaps it was something with IDLE, and since it *does* work on the Python command line, i suspect that there might be an issue with IDLE's way of handling msvcrt.getch().</DIV>
<DIV> </DIV>
<DIV><FONT lang=0 face=Arial size=2 FAMILY="SANSSERIF" PTSIZE="10">Email: dragonfirebane@aol.com<BR>AIM: singingxduck<BR>Programming Python for the fun of it.</FONT></DIV></BODY></HTML>