Guest User

Untitled

a guest
Dec 9th, 2018
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.38 KB | None | 0 0
  1. import curses
  2. stdscr = curses.initscr()
  3. curses.cbreak()
  4. stdscr.keypad(1)
  5.  
  6. stdscr.addstr(0,10,"Hit 'q' to quit")
  7. stdscr.refresh()
  8.  
  9. key = ''
  10. while key != ord('q'):
  11. key = stdscr.getch()
  12. stdscr.addch(20,25,key)
  13. stdscr.refresh()
  14. if key == curses.KEY_UP:
  15. stdscr.addstr(2, 20, "Up")
  16. elif key == curses.KEY_DOWN:
  17. stdscr.addstr(3, 20, "Down")
  18.  
  19. curses.endwin()
Add Comment
Please, Sign In to add comment