The code is:
from curses import *
from curses.panel import *
def main(stdscr):
start_color()
curs_set(0)
init_pair(1, COLOR_BLACK, COLOR_CYAN)
posy = posx = 0
window = newwin(1, 1, posy, posx)
panel = new_panel(window)
window.addstr('*', color_pair(1))
update_panels()
doupdate()
while True:
key = stdscr.getch()
if key == ord('j'):
posy+=1
elif key == ord('k'):
posy-=1
elif key == ord('h'):
posx-=1
elif key == ord('l'):
posx+=1
elif key == ord('q'):
endwin()
break
panel.move(posy,posx)
update_panels()
doupdate()
if __name__ == '__main__':
wrapper(main)
I am getting this error:
Traceback (most recent call last):
File "test_1_height_error.py", line 34, in <module>
wrapper(main)
File "/usr/lib/python3.7/curses/__init__.py", line 94, in wrapper
return func(stdscr, *args, **kwds)
File "test_1_height_error.py", line 12, in main
window.addstr('*', color_pair(1))
_curses.error: addwstr() returned ERR
However if I change line 10 from window = newwin(1, 1, posy, posx) to window = newwin(2, 1, posy, posx) i.e change the nlines args to greater than 1 then it works fine.
I really don't understand why I am getting this issue.