为什么这不起作用?
-- 全部代码在此处... http://pastebin.com/f940nPPg
....snip
f = open(log, 'r')
y = 3;
x = 3;
while True:
c = quote_window.getch()
if c == ord('r') or c == ord('R'):
quote_text_window.clear()
quote_text_window.refresh()
for line in f:
quote_text_window.addstr(line)
y = y + 1
quote_text_window.move(y, x)
elif c == ord('q') or c == ('Q'):
break
stdscr.noutrefresh()
quote_window.noutrefresh()
quote_text_window.noutrefresh()
curses.doupdate()
f.close()
....snip
我遇到了错误
quote_text_window.addstr(line)
_curses.error: addwstr() returned ERR
如果我向addstr()传递字符串字面值,我会得到下面的结果
quote_text_window.move(y, x)
_curses.error: wmove() returned ERR
我正在尝试开发一个用于阅读日志文件的curses接口。我希望能够利用SSH或其他工具,以便在一个接口中读取来自不同计算机的各种日志文件。我知道肯定有很多非常好的程序可以完成这种工作,但我认为这是学习的好方法。因为我是新手,对编程、Python和Curses都不是很熟悉(正如你可能已经注意到的一样)。