Guest User

Untitled

a guest
Nov 24th, 2017
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.68 KB | None | 0 0
  1. import curses
  2.  
  3. def main(win):
  4. win.nodelay(True)
  5. key = ''
  6. record = ''
  7. win.clear()
  8. win.addstr("Key:")
  9. win.addstr('nnRecord:')
  10. win.addstr(record)
  11. while True:
  12. try:
  13. key = win.getkey()
  14. if str(key) == '^?':
  15. record = record[:-1]
  16. else:
  17. record += str(key)
  18. win.clear()
  19. win.addstr("Key:")
  20. win.addstr(str(key))
  21. win.addstr('nnRecord:')
  22. win.addstr(record)
  23. if key == os.linesep:
  24. break
  25. except Exception as e:
  26. # No input
  27. pass
  28.  
  29. curses.wrapper(main)
  30.  
  31. # CTRL+C to close the program
Add Comment
Please, Sign In to add comment