curses.panel —- A panel stack extension for curses


Panels are windows with the added feature of depth, so they can be stacked ontop of each other, and only the visible portions of each window will bedisplayed. Panels can be added, moved up or down in the stack, and removed.

函数

The module curses.panel defines the following functions:

  • curses.panel.bottom_panel()
  • Returns the bottom panel in the panel stack.
  • curses.panel.newpanel(_win)
  • Returns a panel object, associating it with the given window win. Be awarethat you need to keep the returned panel object referenced explicitly. If youdon't, the panel object is garbage collected and removed from the panel stack.
  • curses.panel.top_panel()
  • Returns the top panel in the panel stack.
  • curses.panel.update_panels()
  • Updates the virtual screen after changes in the panel stack. This does not callcurses.doupdate(), so you'll have to do this yourself.

Panel Objects

Panel objects, as returned by new_panel() above, are windows with astacking order. There's always a window associated with a panel which determinesthe content, while the panel methods are responsible for the window's depth inthe panel stack.

Panel objects have the following methods:

  • Panel.above()
  • Returns the panel above the current panel.
  • Panel.below()
  • Returns the panel below the current panel.
  • Panel.bottom()
  • Push the panel to the bottom of the stack.
  • Panel.hidden()
  • Returns True if the panel is hidden (not visible), False otherwise.
  • Panel.hide()
  • Hide the panel. This does not delete the object, it just makes the window onscreen invisible.
  • Panel.move(y, x)
  • Move the panel to the screen coordinates (y, x).
  • Panel.replace(win)
  • Change the window associated with the panel to the window win.
  • Panel.setuserptr(_obj)
  • Set the panel's user pointer to obj. This is used to associate an arbitrarypiece of data with the panel, and can be any Python object.
  • Panel.show()
  • Display the panel (which might have been hidden).
  • Panel.top()
  • Push panel to the top of the stack.
  • Panel.userptr()
  • Returns the user pointer for the panel. This might be any Python object.
  • Panel.window()
  • Returns the window object associated with the panel.