Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Re: Reading Keyboard Scan Codes

Thread Tools

Re: Reading Keyboard Scan Codes

Francois Pinard
Posts: n/a
[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

Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to use file I/o codes with form and controls codes Allen ASP .Net 1 12-03-2007 12:04 AM
Virtual Key Codes, Scan Codes and ASCII Codes in C C Programming 2 08-20-2005 11:04 AM
RegEx replace of html codes to ascii codes Greg -- ASP .Net 4 08-09-2005 07:27 PM
Reading Keyboard Scan Codes Michael Bendzick Python 2 07-24-2003 10:11 PM
RE: Reading Keyboard Scan Codes Bjorn Pettersen Python 0 07-23-2003 10:29 PM