Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame^] | 1 | |
| 2 | :mod:`curses.panel` --- A panel stack extension for curses. |
| 3 | =========================================================== |
| 4 | |
| 5 | .. module:: curses.panel |
| 6 | :synopsis: A panel stack extension that adds depth to curses windows. |
| 7 | .. sectionauthor:: A.M. Kuchling <amk@amk.ca> |
| 8 | |
| 9 | |
| 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. |
| 13 | |
| 14 | |
| 15 | .. _cursespanel-functions: |
| 16 | |
| 17 | Functions |
| 18 | --------- |
| 19 | |
| 20 | The module :mod:`curses.panel` defines the following functions: |
| 21 | |
| 22 | |
| 23 | .. function:: bottom_panel() |
| 24 | |
| 25 | Returns the bottom panel in the panel stack. |
| 26 | |
| 27 | |
| 28 | .. function:: new_panel(win) |
| 29 | |
| 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. |
| 33 | |
| 34 | |
| 35 | .. function:: top_panel() |
| 36 | |
| 37 | Returns the top panel in the panel stack. |
| 38 | |
| 39 | |
| 40 | .. function:: update_panels() |
| 41 | |
| 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. |
| 44 | |
| 45 | |
| 46 | .. _curses-panel-objects: |
| 47 | |
| 48 | Panel Objects |
| 49 | ------------- |
| 50 | |
| 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 |
| 54 | the panel stack. |
| 55 | |
| 56 | Panel objects have the following methods: |
| 57 | |
| 58 | |
| 59 | .. method:: Panel.above() |
| 60 | |
| 61 | Returns the panel above the current panel. |
| 62 | |
| 63 | |
| 64 | .. method:: Panel.below() |
| 65 | |
| 66 | Returns the panel below the current panel. |
| 67 | |
| 68 | |
| 69 | .. method:: Panel.bottom() |
| 70 | |
| 71 | Push the panel to the bottom of the stack. |
| 72 | |
| 73 | |
| 74 | .. method:: Panel.hidden() |
| 75 | |
| 76 | Returns true if the panel is hidden (not visible), false otherwise. |
| 77 | |
| 78 | |
| 79 | .. method:: Panel.hide() |
| 80 | |
| 81 | Hide the panel. This does not delete the object, it just makes the window on |
| 82 | screen invisible. |
| 83 | |
| 84 | |
| 85 | .. method:: Panel.move(y, x) |
| 86 | |
| 87 | Move the panel to the screen coordinates ``(y, x)``. |
| 88 | |
| 89 | |
| 90 | .. method:: Panel.replace(win) |
| 91 | |
| 92 | Change the window associated with the panel to the window *win*. |
| 93 | |
| 94 | |
| 95 | .. method:: Panel.set_userptr(obj) |
| 96 | |
| 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. |
| 99 | |
| 100 | |
| 101 | .. method:: Panel.show() |
| 102 | |
| 103 | Display the panel (which might have been hidden). |
| 104 | |
| 105 | |
| 106 | .. method:: Panel.top() |
| 107 | |
| 108 | Push panel to the top of the stack. |
| 109 | |
| 110 | |
| 111 | .. method:: Panel.userptr() |
| 112 | |
| 113 | Returns the user pointer for the panel. This might be any Python object. |
| 114 | |
| 115 | |
| 116 | .. method:: Panel.window() |
| 117 | |
| 118 | Returns the window object associated with the panel. |
| 119 | |