| 1 | \section{\module{curses.panel} ---
|
|---|
| 2 | A panel stack extension for curses.}
|
|---|
| 3 |
|
|---|
| 4 | \declaremodule{standard}{curses.panel}
|
|---|
| 5 | \sectionauthor{A.M. Kuchling}{[email protected]}
|
|---|
| 6 | \modulesynopsis{A panel stack extension that adds depth to
|
|---|
| 7 | curses windows.}
|
|---|
| 8 |
|
|---|
| 9 | Panels are windows with the added feature of depth, so they can be
|
|---|
| 10 | stacked on top of each other, and only the visible portions of
|
|---|
| 11 | each window will be displayed. Panels can be added, moved up
|
|---|
| 12 | or down in the stack, and removed.
|
|---|
| 13 |
|
|---|
| 14 | \subsection{Functions \label{cursespanel-functions}}
|
|---|
| 15 |
|
|---|
| 16 | The module \module{curses.panel} defines the following functions:
|
|---|
| 17 |
|
|---|
| 18 |
|
|---|
| 19 | \begin{funcdesc}{bottom_panel}{}
|
|---|
| 20 | Returns the bottom panel in the panel stack.
|
|---|
| 21 | \end{funcdesc}
|
|---|
| 22 |
|
|---|
| 23 | \begin{funcdesc}{new_panel}{win}
|
|---|
| 24 | Returns a panel object, associating it with the given window \var{win}.
|
|---|
| 25 | Be aware that you need to keep the returned panel object referenced
|
|---|
| 26 | explicitly. If you don't, the panel object is garbage collected and
|
|---|
| 27 | removed from the panel stack.
|
|---|
| 28 | \end{funcdesc}
|
|---|
| 29 |
|
|---|
| 30 | \begin{funcdesc}{top_panel}{}
|
|---|
| 31 | Returns the top panel in the panel stack.
|
|---|
| 32 | \end{funcdesc}
|
|---|
| 33 |
|
|---|
| 34 | \begin{funcdesc}{update_panels}{}
|
|---|
| 35 | Updates the virtual screen after changes in the panel stack. This does
|
|---|
| 36 | not call \function{curses.doupdate()}, so you'll have to do this yourself.
|
|---|
| 37 | \end{funcdesc}
|
|---|
| 38 |
|
|---|
| 39 | \subsection{Panel Objects \label{curses-panel-objects}}
|
|---|
| 40 |
|
|---|
| 41 | Panel objects, as returned by \function{new_panel()} above, are windows
|
|---|
| 42 | with a stacking order. There's always a window associated with a
|
|---|
| 43 | panel which determines the content, while the panel methods are
|
|---|
| 44 | responsible for the window's depth in the panel stack.
|
|---|
| 45 |
|
|---|
| 46 | Panel objects have the following methods:
|
|---|
| 47 |
|
|---|
| 48 | \begin{methoddesc}{above}{}
|
|---|
| 49 | Returns the panel above the current panel.
|
|---|
| 50 | \end{methoddesc}
|
|---|
| 51 |
|
|---|
| 52 | \begin{methoddesc}{below}{}
|
|---|
| 53 | Returns the panel below the current panel.
|
|---|
| 54 | \end{methoddesc}
|
|---|
| 55 |
|
|---|
| 56 | \begin{methoddesc}{bottom}{}
|
|---|
| 57 | Push the panel to the bottom of the stack.
|
|---|
| 58 | \end{methoddesc}
|
|---|
| 59 |
|
|---|
| 60 | \begin{methoddesc}{hidden}{}
|
|---|
| 61 | Returns true if the panel is hidden (not visible), false otherwise.
|
|---|
| 62 | \end{methoddesc}
|
|---|
| 63 |
|
|---|
| 64 | \begin{methoddesc}{hide}{}
|
|---|
| 65 | Hide the panel. This does not delete the object, it just makes the
|
|---|
| 66 | window on screen invisible.
|
|---|
| 67 | \end{methoddesc}
|
|---|
| 68 |
|
|---|
| 69 | \begin{methoddesc}{move}{y, x}
|
|---|
| 70 | Move the panel to the screen coordinates \code{(\var{y}, \var{x})}.
|
|---|
| 71 | \end{methoddesc}
|
|---|
| 72 |
|
|---|
| 73 | \begin{methoddesc}{replace}{win}
|
|---|
| 74 | Change the window associated with the panel to the window \var{win}.
|
|---|
| 75 | \end{methoddesc}
|
|---|
| 76 |
|
|---|
| 77 | \begin{methoddesc}{set_userptr}{obj}
|
|---|
| 78 | Set the panel's user pointer to \var{obj}. This is used to associate an
|
|---|
| 79 | arbitrary piece of data with the panel, and can be any Python object.
|
|---|
| 80 | \end{methoddesc}
|
|---|
| 81 |
|
|---|
| 82 | \begin{methoddesc}{show}{}
|
|---|
| 83 | Display the panel (which might have been hidden).
|
|---|
| 84 | \end{methoddesc}
|
|---|
| 85 |
|
|---|
| 86 | \begin{methoddesc}{top}{}
|
|---|
| 87 | Push panel to the top of the stack.
|
|---|
| 88 | \end{methoddesc}
|
|---|
| 89 |
|
|---|
| 90 | \begin{methoddesc}{userptr}{}
|
|---|
| 91 | Returns the user pointer for the panel. This might be any Python object.
|
|---|
| 92 | \end{methoddesc}
|
|---|
| 93 |
|
|---|
| 94 | \begin{methoddesc}{window}{}
|
|---|
| 95 | Returns the window object associated with the panel.
|
|---|
| 96 | \end{methoddesc}
|
|---|