2 :mod:`curses.panel` --- A panel stack extension for curses.
3 ===========================================================
5 .. module:: curses.panel
6 :synopsis: A panel stack extension that adds depth to curses windows.
7 .. sectionauthor:: A.M. Kuchling <amk@amk.ca>
10 Panels are windows with the added feature of depth, so they can be stacked on
11 top of each other, and only the visible portions of each window will be
12 displayed. Panels can be added, moved up or down in the stack, and removed.
15 .. _cursespanel-functions:
20 The module :mod:`curses.panel` defines the following functions:
23 .. function:: bottom_panel()
25 Returns the bottom panel in the panel stack.
28 .. function:: new_panel(win)
30 Returns a panel object, associating it with the given window *win*. Be aware
31 that you need to keep the returned panel object referenced explicitly. If you
32 don't, the panel object is garbage collected and removed from the panel stack.
35 .. function:: top_panel()
37 Returns the top panel in the panel stack.
40 .. function:: update_panels()
42 Updates the virtual screen after changes in the panel stack. This does not call
43 :func:`curses.doupdate`, so you'll have to do this yourself.
46 .. _curses-panel-objects:
51 Panel objects, as returned by :func:`new_panel` above, are windows with a
52 stacking order. There's always a window associated with a panel which determines
53 the content, while the panel methods are responsible for the window's depth in
56 Panel objects have the following methods:
59 .. method:: Panel.above()
61 Returns the panel above the current panel.
64 .. method:: Panel.below()
66 Returns the panel below the current panel.
69 .. method:: Panel.bottom()
71 Push the panel to the bottom of the stack.
74 .. method:: Panel.hidden()
76 Returns true if the panel is hidden (not visible), false otherwise.
79 .. method:: Panel.hide()
81 Hide the panel. This does not delete the object, it just makes the window on
85 .. method:: Panel.move(y, x)
87 Move the panel to the screen coordinates ``(y, x)``.
90 .. method:: Panel.replace(win)
92 Change the window associated with the panel to the window *win*.
95 .. method:: Panel.set_userptr(obj)
97 Set the panel's user pointer to *obj*. This is used to associate an arbitrary
98 piece of data with the panel, and can be any Python object.
101 .. method:: Panel.show()
103 Display the panel (which might have been hidden).
106 .. method:: Panel.top()
108 Push panel to the top of the stack.
111 .. method:: Panel.userptr()
113 Returns the user pointer for the panel. This might be any Python object.
116 .. method:: Panel.window()
118 Returns the window object associated with the panel.