I'm learning curses for the first time, and I decided to do it in python because it would be easier than constantly recompiling. However, I've hit a hitch. When I try to update a seccond window, I get no output. Here's a code snippet:
import curses
win = curses.initscr()
curses.noecho()
curses.cbreak()
curses.curs_set(0)
field = curses.newwin(1, 20, 1, 1)
field.addstr(0, 0, "Hello, world!", curses.A_REVERSE)
field.refresh()
The normal win window initialized with initscr() works, but the field window doesn't show up. Any help?
Edit: Here's the new, revised code, which still doesn't work.
import curses ex = None def main(stdscr): global ex try: curses.curs_set(0) except Exception, e: ex = e field = curses.newwin(25, 25, 6, 6) field.border() cont = True x, y = 0, 0 while cont: stdscr.clear() field.clear() coords = "%d, %d" % (x, y) stdscr.addstr(5, 5, coords, curses.A_REVERSE) field.addstr(y+2, x+2, "@", curses.A_BOLD) chr = stdscr.getkey() if chr == 'h': if x > 0: x -= 1 if chr == 'l': if x 0: y -= 1 if chr == 'k': if y