windows-curses
windows-curses copied to clipboard
curses.init_pair(0) raises ERR
Trying to call curses.init_pair(0, curses.COLOR_RED, curses.COLOR_BLACK)
raises an exception. You can reproduce it by changing pair from 1 to 0 in example/rain.py
:
- curses.init_pair(1, curses.COLOR_BLUE, bg)
+ curses.init_pair(0, curses.COLOR_BLUE, bg)
Traceback (most recent call last):
File ".\rain.py", line 99, in <module>
curses.wrapper(main)
File "C:\Users\user\AppData\Local\Programs\Python\Python37\lib\curses\__init__.py", line 102, in wrapper
return func(stdscr, *args, **kwds)
File ".\rain.py", line 36, in main
curses.init_pair(0, curses.COLOR_RED, bg)
_curses.error: init_pair() returned ERR
However, curses.color_pair(0)
is working properly I think (it returns black which is the default I believe?).
Looking at source code, it seems that indeed 0 is not a valid pair value, though it works great on Linux.
More exactly, it seems that pair 0 is reserved to default colors. Maybe init_pair should call assume_default_colors
if pair==0
?
I tried to build the project but it seems to fail linking_cursesmodule.obj to symbols from PDCurses library: _cursesmodule.obj : error LNK2001: unresolved external symbol wclrtobot [...]