(n)python中的curses pad不工作

byt*_*101 6 python ncurses

我似乎无法让ncurses pad在python(2.6,2.7和3.2)中工作.直接使用http://docs.python.org/howto/curses.html上的代码我甚至无法让它工作.非填充代码非常有效.

import curses

def func(scr):
    pad = curses.newpad(100, 100)
    pad.addstr(0,0, "Testing")

    #  Displays a section of the pad in the middle of the screen
    pad.refresh( 0,0, 5,5, 10,10)

    scr.refresh()
    scr.getch()

if __name__ == '__main__':
    curses.wrapper(func)
Run Code Online (Sandbox Code Playgroud)

问题是什么?移除垫(并将垫更换为scr)工作正常

Ned*_*ily 7

你正在覆盖垫.尝试getchpad对象而不是主窗口对象调用方法scr并删除scr.refresh.