Re: curses problem reading cursor keys



On Sat, 07 Oct 2006 13:12:33 +0000, Simon Morgan wrote:

import curses

def main(scr):
status = curses.newwin(1, curses.COLS, 0, 0) status.bkgd('0')
status.refresh()

list = curses.newwin(curses.LINES, curses.COLS, 1, 0) list.bkgd('X')
list.refresh()

If I use scr.subwin() instead of curses.newwin()...

y = 0
while True:
c = list.getch()

and scr.getch() instead of list.getch(), things seem to work. I'd still
really like to know what's going on though.

if c in (curses.KEY_UP, curses.KEY_DOWN, ord('z')):
list.addstr("Match!")
elif c == ord('q'):
break

curses.wrapper(main)
.