Re: [Linux] Detect a key press

2006-10-06 Thread hanumizzle
On 10/6/06, Sergei Organov <[EMAIL PROTECTED]> wrote: > Try > > print "->%s\r" % ch > > or just > > sys.stdout.write(ch) Ah! -- http://mail.python.org/mailman/listinfo/python-list

Re: [Linux] Detect a key press

2006-10-06 Thread Sergei Organov
"Jia,Lu" <[EMAIL PROTECTED]> writes: > Hi all > I write a program to detect key press,but , why there is a *space* > before the character I typed.?? There is none. The output I see when I type 1 2 q is: ->1 ->2 ->q If that is what you see, the problem is in your print "->%s"%ch

Re: [Linux] Detect a key press

2006-10-05 Thread hanumizzle
On 5 Oct 2006 21:45:47 -0700, Jia,Lu <[EMAIL PROTECTED]> wrote: > Hi all > I write a program to detect key press,but , why there is a *space* > before the character I typed.?? Puzzles me too, but I know this is really easy in Curses (on top of that, it isn't specific to Linux; curses works on ma

[Linux] Detect a key press

2006-10-05 Thread Jia,Lu
Hi all I write a program to detect key press,but , why there is a *space* before the character I typed.?? #!/usr/bin/env python import sys import tty import termios i = sys.stdin.fileno() o = sys.stdout.fileno() backup = termios.tcgetattr(i) def loop(): while 1: ch =