本文介绍了(n)python中的curses pad无法正常工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我似乎无法使ncurses垫在python(2.6、2.7和3.2)中工作.直接在 http://docs.python.org/howto/curses.html我什至无法使它正常工作.非填充代码效果很好.
I cannot seem to get ncurses pads to work in python (2.6, 2.7, and 3.2). Using code directly off of http://docs.python.org/howto/curses.html I even cannot get it to work. Non-pad code works perfectly.
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)
问题可能是什么?卸下护垫(并将护垫更改为scr)可以正常工作
What can the issue be? Removing the pad (and changing pad to scr) works fine
推荐答案
您正在覆盖键盘.尝试从pad
对象而不是主窗口对象scr
调用getch
方法,然后删除scr.refresh
.
You're overwriting the pad. Try calling the getch
method from the pad
object instead of the main window object scr
and delete the scr.refresh
.
这篇关于(n)python中的curses pad无法正常工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!