<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>&nbsp;</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>&nbsp;</DIV>
<DIV>&gt;&gt;&gt; msvcrt.getch()<BR>'\xff'</DIV>
<DIV>&nbsp;</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>&nbsp;</DIV>
<DIV>&gt;&gt;&gt; </DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV>Hit space to end...</DIV>
<DIV>&nbsp;</DIV>
<DIV>255<BR>&nbsp;255<BR>255<BR>&nbsp;255<BR>255<BR>&nbsp;255<BR>&nbsp;255<BR>255<BR>255<BR>&nbsp;255</DIV>
<DIV>... ##until i hit Control-C</DIV>
<DIV>Traceback (most recent call last):<BR>&nbsp; File "C:/Documents and Settings/Cookie/Desktop/try.py", line 32, in ?<BR>&nbsp;&nbsp;&nbsp; doKeyEvent(key)<BR>&nbsp; File "C:/Documents and Settings/Cookie/Desktop/try.py", line 9, in doKeyEvent<BR>&nbsp;&nbsp;&nbsp; print ord(key)<BR>&nbsp; File "C:\PROGRA~1\lib\idlelib\PyShell.py", line 1128, in write<BR>&nbsp;&nbsp;&nbsp; self.shell.write(s, self.tags)<BR>&nbsp; File "C:\PROGRA~1\lib\idlelib\PyShell.py", line 1117, in write<BR>&nbsp;&nbsp;&nbsp; raise KeyboardInterrupt<BR>KeyboardInterrupt</DIV>
<DIV>&nbsp;</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>&nbsp;</DIV>
<DIV>Thanks in advance, </DIV>
<DIV>Orri</DIV>
<DIV>&nbsp;</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&nbsp;suspect that there might be an issue with IDLE's way of handling msvcrt.getch().</DIV>
<DIV>&nbsp;</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>