Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #36740 > unrolled thread

Re: Keyboard hook in linux

Started byMichael Torrie <torriem@gmail.com>
First post2013-01-13 09:42 -0700
Last post2013-01-13 09:42 -0700
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: Keyboard hook in linux Michael Torrie <torriem@gmail.com> - 2013-01-13 09:42 -0700

#36740 — Re: Keyboard hook in linux

FromMichael Torrie <torriem@gmail.com>
Date2013-01-13 09:42 -0700
SubjectRe: Keyboard hook in linux
Message-ID<mailman.471.1358095337.2939.python-list@python.org>
On 01/13/2013 09:13 AM, K. Elo wrote:
> I am working on a small console app for linux. The idea is to display 
> some sensor values and the screen should update itself in, say, every 10 
> seconds.
> 
> The user should have the possibly to change some configurations or gwt 
> help by pressing different keys (like you can do when running e.g. 
> 'top'). In other words: the program should NOT wait for the keypress (so 
> input() is not the solution), but simply capture keypresses and act 
> accordingly. If no key is pressed, the program should continue updating 
> the screen.

'top' is built using a programming library called 'curses' or 'ncurses.'
 That's likely where you'll need to go to.  At least if you want to be
able to run properly on different terminals.  ncurses handles terminal
output including writing text at certain positions, and input/output,
and even mouse interactions if you felt you needed that.  It's
apparently part of the standard python library:
http://docs.python.org/2/library/curses.html

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web