0

I'm getting this error:-

I have written the following code:-

import curses
from curses import wrapper


def main(stdscr):
    stdscr.clear()  # clears screen
    stdscr.addstr(10, 10, "Hello World!")  # adds text to the screen
    stdscr.addstr(10, 12, "overwritten")
    stdscr.addstr(15, 25, "Tim is great.")
    stdscr.refresh()  # refresh screen
    stdscr.getch()


wrapper(main)

1 Answers1

0

That happens because you want to addstr() outside the prompt window. Try using smaller numbers for the row and column:

import curses
from curses import wrapper
def main(stdscr):
    stdscr.clear()  # clears screen
    stdscr.addstr(0, 0, "Hello World!")  # adds text to the screen
    stdscr.addstr(1, 2, "overwritten")
    stdscr.addstr(5, 15, "Tim is great.")
    stdscr.refresh()  # refresh screen
    stdscr.getch()


wrapper(main)

Also, I'm not well educated in that matter, but I believe that you don't have to import curses here. The only thing from the curses module in your program is the wrapper() function, which you already imported separately.

KuroN3ko
  • 3
  • 2