Created
December 10, 2018 03:06
-
-
Save schappim/a928c1ceeed8983c8eb2c89456bad7e0 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import curses | |
stdscr = curses.initscr() | |
curses.cbreak() | |
stdscr.keypad(1) | |
stdscr.addstr(0,10,"Hit 'q' to quit") | |
stdscr.refresh() | |
key = '' | |
while key != ord('q'): | |
key = stdscr.getch() | |
stdscr.addch(20,25,key) | |
stdscr.refresh() | |
if key == curses.KEY_UP: | |
stdscr.addstr(2, 20, "Up") | |
elif key == curses.KEY_DOWN: | |
stdscr.addstr(3, 20, "Down") | |
curses.endwin() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment