Re: Single key press

2011-12-06 Thread 88888 Dihedral
On Tuesday, December 6, 2011 11:22:18 PM UTC+8, Grant Edwards wrote: > On 2011-12-06, Sergi Pasoev wrote: > > > I wonder if it is realistic to get a single key press in Python > > without ncurses or > > any similar library. > > Yes. Just put the tty associated w

Re: Single key press

2011-12-06 Thread Grant Edwards
On 2011-12-06, Sergi Pasoev wrote: > I wonder if it is realistic to get a single key press in Python > without ncurses or > any similar library. Yes. Just put the tty associated with stdin in raw mode and make single byte read() calls on it. Remember to restore the tty settings

Re: Single key press

2011-12-06 Thread Nobody
On Tue, 06 Dec 2011 10:19:55 +0430, Sergi Pasoev wrote: > I wonder if it is realistic to get a single key press in Python > without ncurses or any similar library. On Unix, you need to use termios.tcsetattr() to disable "canonical mode". Otherwise, the tty driver will only pas

Re: Single key press

2011-12-06 Thread Hans Mulder
On 6/12/11 09:48:39, Steven D'Aprano wrote: On Tue, 06 Dec 2011 10:19:55 +0430, Sergi Pasoev wrote: Hi. I wonder if it is realistic to get a single key press in Python without ncurses or any similar library. In single key press I mean something like j and k in Gnu less program, you pres

Re: Single key press

2011-12-06 Thread Steven D'Aprano
On Tue, 06 Dec 2011 10:19:55 +0430, Sergi Pasoev wrote: > Hi. > > I wonder if it is realistic to get a single key press in Python without > ncurses or > any similar library. In single key press I mean something like j and k > in Gnu less > program, you press the key and and

Re: Single key press

2011-12-06 Thread alex23
On Dec 6, 3:49 pm, Sergi Pasoev wrote: > I wonder if it is realistic to get a single key press in Python > without ncurses or any similar library. It's possible using Tkinter in the standard library: http://www.daniweb.com/software-development/python/code/216830 -- http://mail

Re: Single key press

2011-12-05 Thread 88888 Dihedral
On Tuesday, December 6, 2011 1:49:55 PM UTC+8, Sergi Pasoev wrote: > Hi. > > I wonder if it is realistic to get a single key press in Python > without ncurses or > any similar library. In single key press I mean something like j and k > in Gnu less > program, you press

Single key press

2011-12-05 Thread Sergi Pasoev
Hi. I wonder if it is realistic to get a single key press in Python without ncurses or any similar library. In single key press I mean something like j and k in Gnu less program, you press the key and and it is captured by the script without need to press enter afterwards -- http