[Linux] Detect a key press
Sergei Organov
osv at javad.com
Fri Oct 6 07:32:07 EDT 2006
More information about the Python-list mailing list
Fri Oct 6 07:32:07 EDT 2006
- Previous message (by thread): [Linux] Detect a key press
- Next message (by thread): [Linux] Detect a key press
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
"Jia,Lu" <Roka100 at gmail.com> 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 statement. It implicitly outputs '\n' at the end, and when terminal is set in raw mode, this is not translated into '\r\n' as when terminal is in canonical mode. Try print "->%s\r" % ch or just sys.stdout.write(ch) -- Sergei.
- Previous message (by thread): [Linux] Detect a key press
- Next message (by thread): [Linux] Detect a key press
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list