I am making a text-based game similar to Zork with Python. I have decided to use the curses module, and have run into a problem. I want to scroll the commands and output up after a command is run instead of clearing the screen. But when I use std.scroll(), an exception is raised. Here is the program:
#!/usr/bin/env python # text_adventure.py import curses import curses.wrapper def main(stdscr): curses.echo() stdscr.setscrreg(1, 24) score = 0 moves = 0 statusbar = stdscr.subwin(2, 80, 0, 0) statusbar.addstr(0, 0, 'Dingo'+' '*(58-len('Dingo'))+'Score: %03d Moves: %03d'%(score, moves), curses.A_REVERSE) stdscr.addstr(24, 0, '> ') x = stdscr.getstr(24, 2) x = str(x) stdscr.refresh() # stdscr.erase() stdscr.scroll(3) statusbar.erase() statusbar.addstr(0, 0, x+' '*(58-len(x))+'Score: %03d Moves: % 03d'%(score, moves), curses.A_REVERSE) stdscr.addstr(24, 0, '> ') stdscr.getstr(24, 2) curses.wrapper(main) Unfortunately, the error message isn't very helpful. I'm just hoping somebody out there knows curses and has the answer. -- Ratfink -- http://mail.python.org/mailman/listinfo/python-list