小编rud*_*vdr的帖子

_curses.error: addwstr() 在 newwin 方法上将 nlines 更改为 1 时返回 ERR

代码是:

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)
Run Code Online (Sandbox Code Playgroud)

我收到此错误:

Traceback (most recent call last):
  File …
Run Code Online (Sandbox Code Playgroud)

python ncurses python-curses

3
推荐指数
1
解决办法
5723
查看次数

标签 统计

ncurses ×1

python ×1

python-curses ×1