RE: Reading Keyboard Scan Codes

Discussion in 'Python' started by Bjorn Pettersen, Jul 23, 2003.

  1. > From: Fran├žois Pinard [mailto:p]
    >
    > [Michael Bendzick]
    >
    > > Is there a simple way in python to read a keyboard scan
    > > code? I'm working on a shell script that interfaces
    > > with a proprietary keyboard device (extra buttons) and
    > > need to be able to distinguish between those keys.

    >
    > Within Linux in console mode, you merely do:


    [...]

    > However, 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! :)

    [...]

    I'm assuming you can use the msvcrt module:

    >>> def getch():

    .... import msvcrt
    .... while not msvcrt.kbhit(): pass
    .... return msvcrt.getch()
    ....
    >>> getch()

    'a'
    >>>


    -- bjorn
    Bjorn Pettersen, Jul 23, 2003
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?ISO-8859-1?Q?Rapha=EBl?=

    How to scan Keyboard in Perl or else on Linux ?

    =?ISO-8859-1?Q?Rapha=EBl?=, Nov 4, 2004, in forum: Perl
    Replies:
    2
    Views:
    863
    =?ISO-8859-1?Q?Rapha=EBl?=
    Nov 9, 2004
  2. aman

    scan codes

    aman, Mar 1, 2004, in forum: C Programming
    Replies:
    3
    Views:
    2,340
    E. Robert Tisdale
    Mar 1, 2004
  3. Michael Bendzick

    Reading Keyboard Scan Codes

    Michael Bendzick, Jul 23, 2003, in forum: Python
    Replies:
    2
    Views:
    1,317
    Alan Gauld
    Jul 24, 2003
  4. Francois Pinard

    Re: Reading Keyboard Scan Codes

    Francois Pinard, Jul 24, 2003, in forum: Python
    Replies:
    0
    Views:
    489
    Francois Pinard
    Jul 24, 2003
  5. Replies:
    2
    Views:
    2,797
    Malcolm
    Aug 20, 2005
Loading...

Share This Page