Accordingly, curses requires that you explicitly tell it to redraw
windows, using the refresh() method of window objects. In practice,
this doesn’t really complicate programming with curses much. Most
programs go into a flurry of activity, and then pause waiting for a
keypress or some other action on the part of the user. All you have to
do is to be sure that the screen has been redrawn before pausing to
wait for user input, by simply calling stdscr.refresh() or the
refresh() method of some other relevant window.
要删除到下线(行尾),请使用^{} :
示例:
但是,我真的推荐在任何控制台/TUI编程中使用伟大的urwid。
更新:Bhargav-Rao是对的;您必须显式地调用
window.refresh()
:您需要在第二行代码之前调用
stdscr.refresh()
。这一点在documentation中已经明确了在
stdscr.addstr(5, 5, "Elit metus")
之前使用stdscr.refresh()
。它会起作用的。在相关问题 更多 >
编程相关推荐