Re: Keyboard hook in linux
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:
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!
|All times are GMT. The time now is 06:07 AM.|
Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.