I need a way to detect both the arrow keys and the enter key. I don't have a numpad on my computer, so this statement is looking for a key that doesn't exist:
char = window.getch()
if char == curses.KEY_ENTER:
stdscr.addstr("'enter' key pressed")
I would just use this to get the keypress:
char = window.getkey()
if char == "\n":
stdscr.addstr("'enter' key pressed")
but I also have to get the arrow keys, with the getch()
function. Is there any way I could use these two functions together, or another way that can get both keys that I haven't thought of?