Re: Keyboard hook in linux

Discussion in 'Python' started by K. Elo, Jan 13, 2013.

  1. K. Elo

    K. Elo Guest

    Hi!

    Thanks, Michael, for your quick - and heplful - reply.

    13.01.2013 18:46, Michael Torrie wrote:
    > You're wrong. curses does offer a direct solution to this. Check the
    > docs. Also here's a nice intro document for Python 3:
    > http://docs.python.org/dev/howto/curses.html


    You are right :) The docs tell us (I somehow missed this when reading
    the doc last time):

    "It’s possible to change this behavior with the method nodelay(). After
    nodelay(1), getch() for the window becomes non-blocking and returns
    curses.ERR (a value of -1) when no input is ready. There’s also a
    halfdelay() function, which can be used to (in effect) set a timer on
    each getch(); if no input becomes available within a specified delay
    (measured in tenths of a second), curses raises an exception."

    This is actually funny: if you google for e.g. "capture keystrokes
    python", you will find masses of suggestions, none of them having this
    simple and elegant (i.e. python-like :) ) solution included.

    Now it works and my problem is solved. Thank you!

    Kind regards,
    Kimmo
    K. Elo, Jan 13, 2013
    #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:
    864
    =?ISO-8859-1?Q?Rapha=EBl?=
    Nov 9, 2004
  2. Daniel von Fersen
    Replies:
    1
    Views:
    535
    John Carson
    May 2, 2004
  3. Luc The Perverse

    Windows Keyboard Hook via JNI

    Luc The Perverse, Oct 31, 2006, in forum: Java
    Replies:
    13
    Views:
    1,698
    Luc The Perverse
    Nov 9, 2006
  4. Michael Torrie

    Re: Keyboard hook in linux

    Michael Torrie, Jan 13, 2013, in forum: Python
    Replies:
    0
    Views:
    143
    Michael Torrie
    Jan 13, 2013
  5. Replies:
    0
    Views:
    156
Loading...

Share This Page