curses.panel --- 针对 curses 的面板栈扩展¶
面板是具有添加深度功能的窗口,因此它们可以从上至下堆叠为栈,只有显示每个窗口的可见部分会显示出来。 面板可以在栈中被添加、上移或下移,也可以被移除。
函数¶
curses.panel 模块定义了下列函数:
- curses.panel.bottom_panel()¶
返回面板栈中的底部面板。
- curses.panel.new_panel(win)¶
Returns a panel object, associating it with the given window win and placing the new panel on top of the panel stack. Be aware that you need to keep the returned panel object referenced explicitly. If you don't, the panel object is garbage collected and removed from the panel stack.
- curses.panel.top_panel()¶
返回面板栈中的顶部面板。
- curses.panel.update_panels()¶
在面板栈发生改变后更新虚拟屏幕。 这不会调用
curses.doupdate(),因此你必须自己来调用。
Panel objects¶
Panel 对象,如上面 new_panel() 所返回的对象,是带有栈顺序的多个窗口。 总是会有一个窗口与确定内容的面板相关联,面板方法会负责窗口在面板栈中的深度。
Panel 对象具有以下方法:
- Panel.above()¶
返回当前面板之上的面板。
- Panel.below()¶
返回当前面板之下的面板。
- Panel.bottom()¶
将面板推至栈底部。
如果面板被隐藏(不可见)则返回
True,否则返回False。
- Panel.hide()¶
隐藏面板。 这不会删除对象,它只是让窗口在屏幕上不可见。
- Panel.move(y, x)¶
将面板移至屏幕坐标
(y, x)。
- Panel.replace(win)¶
将与面板相关联的窗口改为窗口 win。
- Panel.set_userptr(obj)¶
将面板的用户指针设为 obj。 这被用来将任意数据与面板相关联,数据可以是任何 Python 对象。
- Panel.show()¶
Display the panel (which might have been hidden), placing it on top of the panel stack.
- Panel.top()¶
将面板推至栈顶部。
- Panel.userptr()¶
返回面板的用户指针。 这可以是任何 Python 对象。
- Panel.window()¶
返回与面板相关联的窗口对象。