【问题标题】:(n)curses pad in python not working(n)python中的诅咒垫不起作用
【发布时间】:2012-09-15 22:28:03
【问题描述】:

我似乎无法让 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)

问题可能是什么?卸下焊盘(并将焊盘更改为 scr)工作正常

【问题讨论】:

  • Linux、Ubuntu 12.04 用于 2.7 和 3.2 以及 Debian 6.0 用于 2.6

标签: python ncurses


【解决方案1】:

您正在覆盖垫。尝试从pad 对象而不是主窗口对象scr 调用getch 方法并删除scr.refresh

【讨论】:

  • 您希望在 pad 窗口而不是基本窗口的上下文中阅读。填充窗口通常是覆盖另一个窗口的临时子窗口。
猜你喜欢
  • 1970-01-01
  • 2014-04-23
  • 2012-04-08
  • 2010-09-24
  • 2013-11-22
  • 1970-01-01
  • 2017-03-19
  • 2012-01-24
  • 2021-08-15
相关资源
最近更新 更多