Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Re: Keyboard hook in linux

Reply
Thread Tools

Re: Keyboard hook in linux

 
 
K. Elo
Guest
Posts: n/a
 
      01-13-2013
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

 
Reply With Quote
 
 
 
Reply

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
Re: Keyboard hook in linux garabik-news-2005-05@kassiopeia.juls.savba.sk Python 0 01-13-2013 06:11 PM
Re: Keyboard hook in linux Michael Torrie Python 0 01-13-2013 04:46 PM
Windows Keyboard Hook via JNI Luc The Perverse Java 13 11-09-2006 07:39 AM
Keyboard error or no keyboard present??? Bud Light Computer Support 2 01-22-2005 04:00 AM
Keyboard Hook Problem (seems verbally unsolvable) Daniel von Fersen C++ 1 05-02-2004 01:53 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57