• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1:mod:`curses.panel` --- A panel stack extension for curses
2==========================================================
3
4.. module:: curses.panel
5   :synopsis: A panel stack extension that adds depth to  curses windows.
6.. sectionauthor:: A.M. Kuchling <amk@amk.ca>
7
8
9Panels are windows with the added feature of depth, so they can be stacked on
10top of each other, and only the visible portions of each window will be
11displayed.  Panels can be added, moved up or down in the stack, and removed.
12
13
14.. _cursespanel-functions:
15
16Functions
17---------
18
19The module :mod:`curses.panel` defines the following functions:
20
21
22.. function:: bottom_panel()
23
24   Returns the bottom panel in the panel stack.
25
26
27.. function:: new_panel(win)
28
29   Returns a panel object, associating it with the given window *win*. Be aware
30   that you need to keep the returned panel object referenced explicitly.  If you
31   don't, the panel object is garbage collected and removed from the panel stack.
32
33
34.. function:: top_panel()
35
36   Returns the top panel in the panel stack.
37
38
39.. function:: update_panels()
40
41   Updates the virtual screen after changes in the panel stack. This does not call
42   :func:`curses.doupdate`, so you'll have to do this yourself.
43
44
45.. _curses-panel-objects:
46
47Panel Objects
48-------------
49
50Panel objects, as returned by :func:`new_panel` above, are windows with a
51stacking order. There's always a window associated with a panel which determines
52the content, while the panel methods are responsible for the window's depth in
53the panel stack.
54
55Panel objects have the following methods:
56
57
58.. method:: Panel.above()
59
60   Returns the panel above the current panel.
61
62
63.. method:: Panel.below()
64
65   Returns the panel below the current panel.
66
67
68.. method:: Panel.bottom()
69
70   Push the panel to the bottom of the stack.
71
72
73.. method:: Panel.hidden()
74
75   Returns true if the panel is hidden (not visible), false otherwise.
76
77
78.. method:: Panel.hide()
79
80   Hide the panel. This does not delete the object, it just makes the window on
81   screen invisible.
82
83
84.. method:: Panel.move(y, x)
85
86   Move the panel to the screen coordinates ``(y, x)``.
87
88
89.. method:: Panel.replace(win)
90
91   Change the window associated with the panel to the window *win*.
92
93
94.. method:: Panel.set_userptr(obj)
95
96   Set the panel's user pointer to *obj*. This is used to associate an arbitrary
97   piece of data with the panel, and can be any Python object.
98
99
100.. method:: Panel.show()
101
102   Display the panel (which might have been hidden).
103
104
105.. method:: Panel.top()
106
107   Push panel to the top of the stack.
108
109
110.. method:: Panel.userptr()
111
112   Returns the user pointer for the panel.  This might be any Python object.
113
114
115.. method:: Panel.window()
116
117   Returns the window object associated with the panel.
118
119