Curses: Character in bottom right corner
Gerrit Holl
gerrit.holl at pobox.com
Sun Oct 31 11:04:04 EST 1999
Hello,
can someone explain me why the following doesn't work:
--- *** ---
#!/usr/bin/python
import curses
def main(stdscr):
maxy, maxx = stdscr.getmaxyx()
stdscr.addstr(maxy-1, maxx-1, "s", curses.A_NORMAL)
stdscr.refresh()
if __name__ == '__main__':
import curses, traceback
try:
stdscr=curses.initscr()
curses.noecho()
curses.cbreak()
stdscr.keypad(1)
main(stdscr) # Enter the main loop
stdscr.keypad(0)
curses.echo()
curses.nocbreak()
curses.endwin() # Terminate curses
except:
stdscr.keypad(0)
curses.echo() ; curses.nocbreak()
curses.endwin()
traceback.print_exc() # Print the exception
--- *** ---
I'm getting this error:
17:05:23:192/693:gerrit at gerrit:~/oefen/python/ncurses$ python test.py
Traceback (innermost last):
File "test.py", line 18, in ?
main(stdscr) # Enter the main loop
File "test.py", line 7, in main
stdscr.addstr(maxy-1, maxx-1, "s", curses.A_NORMAL)
error: [mv]waddstr() returned ERR
It seems that he thinks it falls of the screen, but if I make either x or
y smaller (not both!) it does work, so if I change line 7 to something like
follows, it works.
stdscr.addstr(maxy-2, maxx-1, "s", curses.A_NORMAL)
stdscr.addstr(maxy-1, maxx-2, "s", curses.A_NORMAL)
What am I doing wrong?
regards,
Gerrit.
More information about the Python-list
mailing list