Mailing List Archive

KBHIT in a Windows Environment
I am using Python 1.52 in a Windows 98 enviroment. I
recently tried using the kbhit() function in the msvcrt
module. It appears to work fine in the Python command
line environment but not in the Pythonwin or IDLE
enviroments. Should kbhit() work in those enviroments?
If not, is their an equivalent function that will?
Thanks in advance.
KBHIT in a Windows Environment [ In reply to ]
In article <375f9a49.4431852@netnews.worldnet.att.net>,
NoSpam@SeeBelow.net (Robert Zimmerle) wrote:
> I am using Python 1.52 in a Windows 98 enviroment. I
> recently tried using the kbhit() function in the msvcrt
> module. It appears to work fine in the Python command
> line environment but not in the Pythonwin or IDLE
> enviroments. Should kbhit() work in those enviroments?
> If not, is their an equivalent function that will?
> Thanks in advance.
>
I have had the same problem i ended up using the following format:
try:
main body of code here
except KeyboardInterrupt:
if cntrl C is hit this code gets executed

This works fine as long as you are working within a Python module. I
have code that calls a DLL, and if I am in the DLL when the Cntrl C is
hit Python will not execute the excepthon, although I get a message
that it saw the excepthon. ( This is a known problem)

Sam Schulenburg


Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.