[Tutor] Problem with msvcrt

Ricardo Aráoz ricaraoz at gmail.com
Fri Nov 2 00:14:00 CET 2007


Alan Gauld wrote:
> "Ricardo Aráoz" <ricaraoz at gmail.com> wrote
> 
>> if msvcrt.kbhit() :
>> key = msvcrt.getch()
>> if key == 'h' :
>> print 'Hello'
>>
>> This is XP with 2.5 in Idle. Any ideas?
> 
> IDLE is a GUI app running under Tkinters event loop.
> I doubt if msvcrt works under Tkinter.
> Try running your code in a DOS box.
> 
> Any solution that detects keyboard input will be
> very sensitive to the operational environment.
> Running in a GUI (any GUI) will cause keyboard
> events that are handled by the GUI toolkit.
> msvcrt is designed to catch keyboasrd events
> within a DOS environment.
> 
> See the event handling page of my tutor for how
> to detect keypresses within Tkinter.
> 
> HTH,
> 

Thanks Alan.



More information about the Tutor mailing list