How to fill to lower-right corner in python-curses -


i'm using curses in python3.3 , need fill entire usable space characters. error i'm getting occurs when double loop reaches last corner.

traceback (most recent call last):   file "main.py", line 14, in <module>     curses.wrapper(main)   file "/usr/local/lib/python3.3/curses/__init__.py", line 94, in wrapper     return func(stdscr, *args, **kwds)   file "main.py", line 9, in main     stdscr.addch(y, x, ord('.')) _curses.error: addch() returned err 

i've noticed each time character added, cursor moves right. haven't tested thoroughly might have, suspect cursor leaves end of window on last call stdscr.addch, causes error.

an additional note using maximum width or height 1 unit under window returns, i'm able loop without error.

source fails:

import curses  def main(stdscr):     height, width = stdscr.getmaxyx()     y in range(height):         x in range(width):             stdscr.addch(y, x, ord('.'))     stdscr.refresh()     stdscr.getch()  if __name__ == '__main__':     curses.wrapper(main) 

for project, it's important use complete rectangle. point i've shortened max width 80 79, if knows way write last corner, i'd hear it.

calling insch in corner instead of addch worked me.


Comments

Popular posts from this blog

python - Subclassed QStyledItemDelegate ignores Stylesheet -

java - HttpClient 3.1 Connection pooling vs HttpClient 4.3.2 -

SQL: Divide the sum of values in one table with the count of rows in another -