GNU Info

Info Node: (python2.1-lib.info)Window Objects

(python2.1-lib.info)Window Objects


Next: Constants Prev: Functions 2 Up: curses
Enter node , (file) or (file)node

Window Objects
--------------

Window objects, as returned by `initscr()' and `newwin()' above, have
the following methods:

`addch([y, x,] ch[, attr])'
     *Note:* A _character_ means a C character (i.e., an ASCII code),
     rather then a Python character (a string of length 1).  (This note
     is true whenever the documentation mentions a character.)  The
     builtin `ord()' is handy for conveying strings to codes.

     Paint character CH at `(Y, X)' with attributes ATTR, overwriting
     any character previously painter at that location.  By default,
     the character position and attributes are the current settings for
     the window object.

`addnstr([y, x,] str, n[, attr])'
     Paint at most N characters of the string STR at `(Y, X)' with
     attributes ATTR, overwriting anything previously on the display.

`addstr([y, x,] str[, attr])'
     Paint the string STR at `(Y, X)' with attributes ATTR, overwriting
     anything previously on the display.

`attroff(attr)'
     Remove attribute ATTR from the "background" set applied to all
     writes to the current window.

`attron(attr)'
     Add attribute ATTR from the "background" set applied to all writes
     to the current window.

`attrset(attr)'
     Set the "background" set of attributes to ATTR.  This set is
     initially 0 (no attributes).

`bkgd(ch[, attr])'
     Sets the background property of the window to the character CH,
     with attributes ATTR.  The change is then applied to every
     character position in that window:
        * The attribute of every character in the window  is changed to
          the new background attribute.

        * Wherever  the  former background character appears, it is
          changed to the new background character.

`bkgdset(ch[, attr])'
     Sets the window's background.  A window's background consists of a
     character and any combination of attributes.  The attribute part of
     the background is combined (OR'ed) with all non-blank characters
     that are written into the window.  Both the character and
     attribute parts of the background are combined with the blank
     characters.  The background becomes a property of the character
     and moves with the character through any scrolling and
     insert/delete line/character operations.

`border([ls[, rs[, ts[, bs[, tl[, tr[, bl[, br]]]]]]]])'
     Draw a border around the edges of the window. Each parameter
     specifies the character to use for a specific part of the border;
     see the table below for more details.  The characters must be
     specified as integers; using one-character strings will cause
     `TypeError' to be raised.

     *Note:* A `0' value for any parameter will cause the default
     character to be used for that parameter.  Keyword parameters can
     _not_ be used.  The defaults are listed in this table:

     Parameter              Description            Default value
     ------                 -----                  -----
     ls                     Left side              `ACS_VLINE'
     rs                     Right side             `ACS_VLINE'
     ts                     Top                    `ACS_HLINE'
     bs                     Bottom                 `ACS_HLINE'
     tl                     Upper-left corner      `ACS_ULCORNER'
     tr                     Upper-right corner     `ACS_URCORNER'
     bl                     Bottom-left corner     `ACS_BLCORNER'
     br                     Bottom-right corner    `ACS_BRCORNER'

`box([vertch, horch])'
     Similar to `border()', but both LS and RS are VERTCH and both TS
     and {bs} are HORCH.  The default corner characters are always used
     by this function.

`clear()'
     Like `erase()', but also causes the whole window to be repainted
     upon next call to `refresh()'.

`clearok(yes)'
     If YES is 1, the next call to `refresh()' will clear the window
     completely.

`clrtobot()'
     Erase from cursor to the end of the window: all lines below the
     cursor are deleted, and then the equivalent of `clrtoeol()' is
     performed.

`clrtoeol()'
     Erase from cursor to the end of the line.

`cursyncup()'
     Updates the current cursor position of all the ancestors of the
     window to reflect the current cursor position of the window.

`delch([x, y])'
     Delete any character at `(Y, X)'.

`deleteln()'
     Delete the line under the cursor. All following lines are moved up
     by 1 line.

`derwin([nlines, ncols,] begin_y, begin_x)'
     An abbreviation for "derive window", `derwin()' is the same as
     calling `subwin()', except that BEGIN_Y and BEGIN_X are relative
     to the origin of the window, rather than relative to the entire
     screen.  Returns a window object for the derived window.

`echochar(ch[, attr])'
     Add character CH with attribute ATTR, and immediately call
     `refresh()' on the window.

`enclose(y, x)'
     Tests whether the given pair of screen-relative character-cell
     coordinates are enclosed by the given window, returning true or
     false.  It is useful for determining what subset of the screen
     windows enclose the location of a mouse event.

`erase()'
     Clear the window.

`getbegyx()'
     Return a tuple `(Y, X)' of co-ordinates of upper-left corner.

`getch([x, y])'
     Get a character. Note that the integer returned does _not_ have to
     be in ASCII range: function keys, keypad keys and so on return
     numbers higher than 256. In no-delay mode, an exception is raised
     if there is no input.

`getkey([x, y])'
     Get a character, returning a string instead of an integer, as
     `getch()' does. Function keys, keypad keys and so on return a
     multibyte string containing the key name.  In no-delay mode, an
     exception is raised if there is no input.

`getmaxyx()'
     Return a tuple `(Y, X)' of the height and width of the window.

`getparyx()'
     Returns the beginning coordinates of this window relative to its
     parent window into two integer variables y and x.  Returns `-1,-1'
     if this window has no parent.

`getstr([x, y])'
     Read a string from the user, with primitive line editing capacity.

`getyx()'
     Return a tuple `(Y, X)' of current cursor position relative to the
     window's upper-left corner.

`hline([y, x,] ch, n)'
     Display a horizontal line starting at `(Y, X)' with length N
     consisting of the character CH.

`idcok(flag)'
     If FLAG is false, curses no longer considers using the hardware
     insert/delete character feature of the terminal; if FLAG is true,
     use of character insertion and deletion is enabled.  When curses
     is first initialized, use of character insert/delete is enabled by
     default.

`idlok(yes)'
     If called with YES equal to 1, `curses' will try and use hardware
     line editing facilities. Otherwise, line insertion/deletion are
     disabled.

`immedok(flag)'
     If FLAG is true, any change in the window image automatically
     causes the window to be refreshed; you no longer have to call
     `refresh()' yourself.  However, it may degrade performance
     considerably, due to repeated calls to wrefresh.  This option is
     disabled by default.

`inch([x, y])'
     Return the character at the given position in the window. The
     bottom 8 bits are the character proper, and upper bits are the
     attributes.

`insch([y, x,] ch[, attr])'
     Paint character CH at `(Y, X)' with attributes ATTR, moving the
     line from position X right by one character.

`insdelln(nlines)'
     Inserts NLINES lines into the specified window above the current
     line.  The NLINES bottom lines are lost.  For negative NLINES,
     delete NLINES lines starting with the one under the cursor, and
     move the remaining lines up.  The bottom NLINES lines are cleared.
     The current cursor position remains the same.

`insertln()'
     Insert a blank line under the cursor. All following lines are moved
     down by 1 line.

`insnstr([y, x,] str, n [, attr])'
     Insert a character string (as many characters as will fit on the
     line) before the character under the cursor, up to N characters.
     If N is zero or negative, the entire string is inserted.  All
     characters to the right of the cursor are shifted right, with the
     the rightmost characters on the line being lost.  The cursor
     position does not change (after moving to Y, X, if specified).

`insstr([y, x, ] str [, attr])'
     Insert a character string (as many characters as will fit on the
     line) before the character under the cursor.  All characters to
     the right of the cursor are shifted right, with the the rightmost
     characters on the line being lost.  The cursor position does not
     change (after moving to Y, X, if specified).

`instr([y, x] [, n])'
     Returns a string of characters, extracted from the window starting
     at the current cursor position, or at Y, X if specified.
     Attributes are stripped from the characters.  If N is specified,
     `instr()' returns return a string at most N characters long
     (exclusive of the trailing NUL).

`is_linetouched(LINE)'
     Returns true if the specified line was modified since the last
     call to `refresh()'; otherwise returns false.  Raises a
     `curses.error' exception if LINE is not valid for the given window.

`is_wintouched()'
     Returns true if the specified window was modified since the last
     call to `refresh()'; otherwise returns false.

`keypad(yes)'
     If YES is 1, escape sequences generated by some keys (keypad,
     function keys) will be interpreted by `curses'.  If YES is 0,
     escape sequences will be left as is in the input stream.

`leaveok(yes)'
     If YES is 1, cursor is left where it is on update, instead of
     being at "cursor position."  This reduces cursor movement where
     possible. If possible the cursor will be made invisible.

     If YES is 0, cursor will always be at "cursor position" after an
     update.

`move(new_y, new_x)'
     Move cursor to `(NEW_Y, NEW_X)'.

`mvderwin(y, x)'
     Moves the window inside its parent window.  The screen-relative
     parameters of the window are not changed.  This routine is used to
     display different parts of the parent window at the same physical
     position on the screen.

`mvwin(new_y, new_x)'
     Move the window so its upper-left corner is at `(NEW_Y, NEW_X)'.

`nodelay(yes)'
     If YES is `1', `getch()' will be non-blocking.

`notimeout(yes)'
     If YES is `1', escape sequences will not be timed out.

     If YES is `0', after a few milliseconds, an escape sequence will
     not be interpreted, and will be left in the input stream as is.

`noutrefresh()'
     Mark for refresh but wait.  This function updates the data
     structure representing the desired state of the window, but does
     not force an update of the physical screen.  To accomplish that,
     call `doupdate()'.

`overlay(destwin[, sminrow, smincol, dminrow, dmincol, dmaxrow, dmaxcol])'
     Overlay the window on top of DESTWIN. The windows need not be the
     same size, only the overlapping region is copied. This copy is
     non-destructive, which means that the current background character
     does not overwrite the old contents of DESTWIN.

     To get fine-grained control over the copied region, the second form
     of `overlay()' can be used. SMINROW and SMINCOL are the upper-left
     coordinates of the source window, and the other variables mark a
     rectangle in the destination window.

`overwrite(destwin[, sminrow, smincol, dminrow, dmincol, dmaxrow, dmaxcol])'
     Overwrite the window on top of DESTWIN. The windows need not be
     the same size, in which case only the overlapping region is
     copied. This copy is destructive, which means that the current
     background character overwrites the old contents of DESTWIN.

     To get fine-grained control over the copied region, the second form
     of `overwrite()' can be used. SMINROW and SMINCOL are the
     upper-left coordinates of the source window, the other variables
     mark a rectangle in the destination window.

`putwin(file)'
     Writes all data associated with the window into the provided file
     object.  This information can be later retrieved using the
     `getwin()' function.

`redrawln(beg, num)'
     Indicates that the NUM screen lines, starting at line BEG, are
     corrupted and should be completely redrawn on the next `refresh()'
     call.

`redrawwin()'
     Touches the entire window, causing it to be completely redrawn on
     the next `refresh()' call.

`refresh([pminrow, pmincol, sminrow, smincol, smaxrow, smaxcol])'
     Update the display immediately (sync actual screen with previous
     drawing/deleting methods).

     The 6 optional arguments can only be specified when the window is a
     pad created with `newpad()'.  The additional parameters are needed
     to indicate what part of the pad and screen are involved.  PMINROW
     and PMINCOL specify the upper left-hand corner of the rectangle to
     be displayed in the pad.  SMINROW, SMINCOL, SMAXROW, and SMAXCOL
     specify the edges of the rectangle to be displayed on the screen.
     The lower right-hand corner of the rectangle to be displayed in
     the pad is calculated from the screen coordinates, since the
     rectangles must be the same size.  Both rectangles must be
     entirely contained within their respective structures.  Negative
     values of PMINROW, PMINCOL, SMINROW, or SMINCOL are treated as if
     they were zero.

`scroll([lines` = 1'])'
     Scroll the screen or scrolling region upward by LINES lines.

`scrollok(flag)'
     Controls what happens when the cursor of a window is moved off the
     edge of the window or scrolling region, either as a result of a
     newline action on the bottom line, or typing the last character of
     the last line.  If FLAG is false, the cursor is left on the bottom
     line.  If FLAG is true, the window is scrolled up one line.  Note
     that in order to get the physical scrolling effect on the
     terminal, it is also necessary to call `idlok()'.

`setscrreg(top, bottom)'
     Set the scrolling region from line TOP to line BOTTOM. All
     scrolling actions will take place in this region.

`standend()'
     Turn off the standout attribute.  On some terminals this has the
     side effect of turning off all attributes.

`standout()'
     Turn on attribute A_STANDOUT.

`subpad([nlines, ncols,] begin_y, begin_x)'
     Return a sub-window, whose upper-left corner is at `(BEGIN_Y,
     BEGIN_X)', and whose width/height is NCOLS/NLINES.

`subwin([nlines, ncols,] begin_y, begin_x)'
     Return a sub-window, whose upper-left corner is at `(BEGIN_Y,
     BEGIN_X)', and whose width/height is NCOLS/NLINES.

     By default, the sub-window will extend from the specified position
     to the lower right corner of the window.

`syncdown()'
     Touches each location in the window that has been touched in any of
     its ancestor windows.  This routine is called by `refresh()', so
     it should almost never be necessary to call it manually.

`syncok(flag)'
     If called with FLAG set to true, then `syncup()' is called
     automatically whenever there is a change in the window.

`syncup()'
     Touches all locations in ancestors of the window that have been
     changed in the window.

`timeout(delay)'
     Sets blocking or non-blocking read behavior for the window.  If
     DELAY is negative, blocking read is used, which will wait
     indefinitely for input).  If DELAY is zero, then non-blocking read
     is used, and -1 will be returned by `getch()' if no input is
     waiting.  If DELAY is positive, then `getch()' will block for
     DELAY milliseconds, and return -1 if there is still no input at
     the end of that time.

`touchline(start, count)'
     Pretend COUNT lines have been changed, starting with line START.

`touchwin()'
     Pretend the whole window has been changed, for purposes of drawing
     optimizations.

`untouchwin()'
     Marks all lines in  the  window  as unchanged since the last call
     to `refresh()'.

`vline([y, x,] ch, n)'
     Display a vertical line starting at `(Y, X)' with length N
     consisting of the character CH.


automatically generated by info2www version 1.2.2.9