def print_line(line, highlight=False):
 global lineno
 try:
  if highlight:
   line += (' ' * (win.getmaxyx()[1] - len(line)))
   win.addstr(lineno, 0, line, curses.A_REVERSE)
  else:
   win.addstr(lineno, 0, line, 0)
 except curses.error:
  lineno = 0
  win.refresh()
  raise
 else:
  lineno += 1

def print_line ( line , highlight = False ) : global lineno try : if highlight : line += ( ' ' * ( win . getmaxyx ( ) [ 1 ] - len ( line ) ) ) win . addstr ( lineno , 0 , line , curses . A_REVERSE ) else : win . addstr ( lineno , 0 , line , 0 ) except curses . error : lineno = 0 win . refresh ( ) raise else : lineno += 1
a thin wrapper around cursess addstr() .