ttytest.py 320 B

1234567891011121314151617
  1. import sys
  2. import select
  3. import tty
  4. import termios
  5. import os
  6. print "#> ",
  7. os.system("stty cbreak -echo")
  8. cmdstring = ''
  9. while True:
  10. #print '---'
  11. a = sys.stdin.read(1)
  12. cmdstring = cmdstring + a
  13. sys.stdout.write(cmdstring)
  14. sys.stdout.write('\r')
  15. sys.stdout.flush()
  16. os.system("stty -cbreak echo")