Reading Keyboard Scan Codes
Francois Pinard
pinard at iro.umontreal.ca
Wed Jul 23 21:44:12 EDT 2003
[François Pinard]
> [...] I do not know if reading scan codes or key codes is easily done
> within X, nor on MS-Windows. I would like finding or discovering recipes
> in this area. So, please share your tricks in this area, if any! :-)
[Bjorn Pettersen]
> I'm assuming you can use the msvcrt module:
> >>> def getch():
> ... import msvcrt
> ... while not msvcrt.kbhit(): pass
> ... return msvcrt.getch()
> ...
> >>> getch()
> 'a'
> >>>
This does not give scan codes (or key codes of some sort). I would like
being able to detect, for example, if Ctrl is being held while Keypad-5
is entered, or any other such (possibly unusual) combination of keys.
--
François Pinard http://www.iro.umontreal.ca/~pinard
More information about the Python-list
mailing list