Ignore:
Timestamp:
Mar 19, 2014, 11:31:01 PM (11 years ago)
Author:
dmik
Message:

python: Merge vendor 2.7.6 to trunk.

Location:
python/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • python/trunk

  • python/trunk/Doc/library/curses.rst

    r2 r391  
    4545      Editable text widget for curses supporting  :program:`Emacs`\ -like bindings.
    4646
    47    Module :mod:`curses.wrapper`
    48       Convenience function to ensure proper terminal setup and resetting on
    49       application entry and exit.
    50 
    5147   :ref:`curses-howto`
    5248      Tutorial material on using curses with Python, by Andrew Kuchling and Eric
    5349      Raymond.
    5450
    55    The :file:`Demo/curses/` directory in the Python source distribution contains
     51   The :source:`Demo/curses/` directory in the Python source distribution contains
    5652   some example programs using the curses bindings provided by this module.
    5753
     
    8076.. function:: baudrate()
    8177
    82    Returns the output speed of the terminal in bits per second.  On software
     78   Return the output speed of the terminal in bits per second.  On software
    8379   terminal emulators it will have a fixed high value. Included for historical
    8480   reasons; in former times, it was used to  write output loops for time delays and
     
    9389.. function:: can_change_color()
    9490
    95    Returns true or false, depending on whether the programmer can change the colors
     91   Return ``True`` or ``False``, depending on whether the programmer can change the colors
    9692   displayed by the terminal.
    9793
     
    108104.. function:: color_content(color_number)
    109105
    110    Returns the intensity of the red, green, and blue (RGB) components in the color
     106   Return the intensity of the red, green, and blue (RGB) components in the color
    111107   *color_number*, which must be between ``0`` and :const:`COLORS`.  A 3-tuple is
    112108   returned, containing the R,G,B values for the given color, which will be between
     
    116112.. function:: color_pair(color_number)
    117113
    118    Returns the attribute value for displaying text in the specified color.  This
     114   Return the attribute value for displaying text in the specified color.  This
    119115   attribute value can be combined with :const:`A_STANDOUT`, :const:`A_REVERSE`,
    120116   and the other :const:`A_\*` attributes.  :func:`pair_number` is the counterpart
     
    124120.. function:: curs_set(visibility)
    125121
    126    Sets the cursor state.  *visibility* can be set to 0, 1, or 2, for invisible,
     122   Set the cursor state.  *visibility* can be set to 0, 1, or 2, for invisible,
    127123   normal, or very visible.  If the terminal supports the visibility requested, the
    128124   previous cursor state is returned; otherwise, an exception is raised.  On many
     
    133129.. function:: def_prog_mode()
    134130
    135    Saves the current terminal mode as the "program" mode, the mode when the running
     131   Save the current terminal mode as the "program" mode, the mode when the running
    136132   program is using curses.  (Its counterpart is the "shell" mode, for when the
    137133   program is not in curses.)  Subsequent calls to :func:`reset_prog_mode` will
     
    141137.. function:: def_shell_mode()
    142138
    143    Saves the current terminal mode as the "shell" mode, the mode when the running
     139   Save the current terminal mode as the "shell" mode, the mode when the running
    144140   program is not using curses.  (Its counterpart is the "program" mode, when the
    145141   program is using curses capabilities.) Subsequent calls to
     
    149145.. function:: delay_output(ms)
    150146
    151    Inserts an *ms* millisecond pause in output.
     147   Insert an *ms* millisecond pause in output.
    152148
    153149
     
    180176.. function:: erasechar()
    181177
    182    Returns the user's current erase character.  Under Unix operating systems this
     178   Return the user's current erase character.  Under Unix operating systems this
    183179   is a property of the controlling tty of the curses program, and is not set by
    184180   the curses library itself.
     
    188184
    189185   The :func:`.filter` routine, if used, must be called before :func:`initscr` is
    190    called.  The effect is that, during those calls, LINES is set to 1; the
     186   called.  The effect is that, during those calls, :envvar:`LINES` is set to 1; the
    191187   capabilities clear, cup, cud, cud1, cuu1, cuu, vpa are disabled; and the home
    192188   string is set to the value of cr. The effect is that the cursor is confined to
     
    214210   5-tuple ``(id, x, y, z, bstate)``. *id* is an ID value used to distinguish
    215211   multiple devices, and *x*, *y*, *z* are the event's coordinates.  (*z* is
    216    currently unused.).  *bstate* is an integer value whose bits will be set to
     212   currently unused.)  *bstate* is an integer value whose bits will be set to
    217213   indicate the type of event, and will be the bitwise OR of one or more of the
    218214   following constants, where *n* is the button number from 1 to 4:
     
    224220.. function:: getsyx()
    225221
    226    Returns the current coordinates of the virtual screen cursor in y and x.  If
     222   Return the current coordinates of the virtual screen cursor in y and x.  If
    227223   leaveok is currently true, then -1,-1 is returned.
    228224
     
    230226.. function:: getwin(file)
    231227
    232    Reads window related data stored in the file by an earlier :func:`putwin` call.
     228   Read window related data stored in the file by an earlier :func:`putwin` call.
    233229   The routine then creates and initializes a new window using that data, returning
    234230   the new window object.
     
    237233.. function:: has_colors()
    238234
    239    Returns true if the terminal can display colors; otherwise, it returns false.
     235   Return ``True`` if the terminal can display colors; otherwise, return ``False``.
    240236
    241237
    242238.. function:: has_ic()
    243239
    244    Returns true if the terminal has insert- and delete- character capabilities.
     240   Return ``True`` if the terminal has insert- and delete-character capabilities.
    245241   This function is included for historical reasons only, as all modern software
    246242   terminal emulators have such capabilities.
     
    249245.. function:: has_il()
    250246
    251    Returns true if the terminal has insert- and delete-line  capabilities,  or can
     247   Return ``True`` if the terminal has insert- and delete-line capabilities, or can
    252248   simulate  them  using scrolling regions. This function is included for
    253249   historical reasons only, as all modern software terminal emulators have such
     
    257253.. function:: has_key(ch)
    258254
    259    Takes a key value *ch*, and returns true if the current terminal type recognizes
     255   Take a key value *ch*, and return ``True`` if the current terminal type recognizes
    260256   a key with that value.
    261257
     
    266262   typed by the user are immediately available to the program. However, after
    267263   blocking for *tenths* tenths of seconds, an exception is raised if nothing has
    268    been typed.  The value of *tenths* must be a number between 1 and 255.  Use
     264   been typed.  The value of *tenths* must be a number between ``1`` and ``255``.  Use
    269265   :func:`nocbreak` to leave half-delay mode.
    270266
     
    272268.. function:: init_color(color_number, r, g, b)
    273269
    274    Changes the definition of a color, taking the number of the color to be changed
     270   Change the definition of a color, taking the number of the color to be changed
    275271   followed by three RGB values (for the amounts of red, green, and blue
    276272   components).  The value of *color_number* must be between ``0`` and
     
    283279.. function:: init_pair(pair_number, fg, bg)
    284280
    285    Changes the definition of a color-pair.  It takes three arguments: the number of
     281   Change the definition of a color-pair.  It takes three arguments: the number of
    286282   the color-pair to be changed, the foreground color number, and the background
    287283   color number.  The value of *pair_number* must be between ``1`` and
     
    295291.. function:: initscr()
    296292
    297    Initialize the library. Returns a :class:`WindowObject` which represents the
     293   Initialize the library. Return a :class:`WindowObject` which represents the
    298294   whole screen.
    299295
     
    304300
    305301
     302.. function:: is_term_resized(nlines, ncols)
     303
     304   Return ``True`` if :func:`resize_term` would modify the window structure,
     305   ``False`` otherwise.
     306
     307
    306308.. function:: isendwin()
    307309
    308    Returns true if :func:`endwin` has been called (that is, the  curses library has
     310   Return ``True`` if :func:`endwin` has been called (that is, the  curses library has
    309311   been deinitialized).
    310312
     
    322324.. function:: killchar()
    323325
    324    Returns the user's current line kill character. Under Unix operating systems
     326   Return the user's current line kill character. Under Unix operating systems
    325327   this is a property of the controlling tty of the curses program, and is not set
    326328   by the curses library itself.
     
    329331.. function:: longname()
    330332
    331    Returns a string containing the terminfo long name field describing the current
     333   Return a string containing the terminfo long name field describing the current
    332334   terminal.  The maximum length of a verbose description is 128 characters.  It is
    333335   defined only after the call to :func:`initscr`.
     
    342344.. function:: mouseinterval(interval)
    343345
    344    Sets the maximum time in milliseconds that can elapse between press and release
    345    events in order for them to be recognized as a click, and returns the previous
     346   Set the maximum time in milliseconds that can elapse between press and release
     347   events in order for them to be recognized as a click, and return the previous
    346348   interval value.  The default value is 200 msec, or one fifth of a second.
    347349
     
    349351.. function:: mousemask(mousemask)
    350352
    351    Sets the mouse events to be reported, and returns a tuple ``(availmask,
     353   Set the mouse events to be reported, and return a tuple ``(availmask,
    352354   oldmask)``.   *availmask* indicates which of the specified mouse events can be
    353355   reported; on complete failure it returns 0.  *oldmask* is the previous value of
     
    363365.. function:: newpad(nlines, ncols)
    364366
    365    Creates and returns a pointer to a new pad data structure with the given number
     367   Create and return a pointer to a new pad data structure with the given number
    366368   of lines and columns.  A pad is returned as a window object.
    367369
     
    373375   methods of a pad require 6 arguments to specify the part of the pad to be
    374376   displayed and the location on the screen to be used for the display. The
    375    arguments are pminrow, pmincol, sminrow, smincol, smaxrow, smaxcol; the p
     377   arguments are *pminrow*, *pmincol*, *sminrow*, *smincol*, *smaxrow*, *smaxcol*; the *p*
    376378   arguments refer to the upper left corner of the pad region to be displayed and
    377    the s arguments define a clipping box on the screen within which the pad region
     379   the *s* arguments define a clipping box on the screen within which the pad region
    378380   is to be displayed.
    379381
    380382
    381 .. function:: newwin([nlines, ncols,] begin_y, begin_x)
     383.. function:: newwin(begin_y, begin_x)
     384              newwin(nlines, ncols, begin_y, begin_x)
    382385
    383386   Return a new window, whose left-upper corner is at  ``(begin_y, begin_x)``, and
     
    417420.. function:: noqiflush()
    418421
    419    When the noqiflush routine is used, normal flush of input and output queues
     422   When the :func:`noqiflush` routine is used, normal flush of input and output queues
    420423   associated with the INTR, QUIT and SUSP characters will not be done.  You may
    421424   want to call :func:`noqiflush` in a signal handler if you want output to
     
    430433.. function:: pair_content(pair_number)
    431434
    432    Returns a tuple ``(fg, bg)`` containing the colors for the requested color pair.
     435   Return a tuple ``(fg, bg)`` containing the colors for the requested color pair.
    433436   The value of *pair_number* must be between ``1`` and ``COLOR_PAIRS - 1``.
    434437
     
    436439.. function:: pair_number(attr)
    437440
    438    Returns the number of the color-pair set by the attribute value *attr*.
     441   Return the number of the color-pair set by the attribute value *attr*.
    439442   :func:`color_pair` is the counterpart to this function.
    440443
     
    442445.. function:: putp(string)
    443446
    444    Equivalent to ``tputs(str, 1, putchar)``; emits the value of a specified
    445    terminfo capability for the current terminal.  Note that the output of putp
     447   Equivalent to ``tputs(str, 1, putchar)``; emit the value of a specified
     448   terminfo capability for the current terminal.  Note that the output of :func:`putp`
    446449   always goes to standard output.
    447450
     
    449452.. function:: qiflush( [flag] )
    450453
    451    If *flag* is false, the effect is the same as calling :func:`noqiflush`. If
    452    *flag* is true, or no argument is provided, the queues will be flushed when
     454   If *flag* is ``False``, the effect is the same as calling :func:`noqiflush`. If
     455   *flag* is ``True``, or no argument is provided, the queues will be flushed when
    453456   these control characters are read.
    454457
     
    463466.. function:: reset_prog_mode()
    464467
    465    Restores the  terminal  to "program" mode, as previously saved  by
     468   Restore the  terminal  to "program" mode, as previously saved  by
    466469   :func:`def_prog_mode`.
    467470
     
    469472.. function:: reset_shell_mode()
    470473
    471    Restores the  terminal  to "shell" mode, as previously saved  by
     474   Restore the  terminal  to "shell" mode, as previously saved  by
    472475   :func:`def_shell_mode`.
    473476
    474477
     478.. function:: resetty()
     479
     480   Restore the state of the terminal modes to what it was at the last call to
     481   :func:`savetty`.
     482
     483
     484.. function:: resize_term(nlines, ncols)
     485
     486   Backend function used by :func:`resizeterm`, performing most of the work;
     487   when resizing the windows, :func:`resize_term` blank-fills the areas that are
     488   extended.  The calling application should fill in these areas with
     489   appropriate data.  The :func:`resize_term` function attempts to resize all
     490   windows.  However, due to the calling convention of pads, it is not possible
     491   to resize these without additional interaction with the application.
     492
     493
     494.. function:: resizeterm(nlines, ncols)
     495
     496   Resize the standard and current windows to the specified dimensions, and
     497   adjusts other bookkeeping data used by the curses library that record the
     498   window dimensions (in particular the SIGWINCH handler).
     499
     500
     501.. function:: savetty()
     502
     503   Save the current state of the terminal modes in a buffer, usable by
     504   :func:`resetty`.
     505
     506
    475507.. function:: setsyx(y, x)
    476508
    477    Sets the virtual screen cursor to *y*, *x*. If *y* and *x* are both -1, then
     509   Set the virtual screen cursor to *y*, *x*. If *y* and *x* are both -1, then
    478510   leaveok is set.
    479511
     
    481513.. function:: setupterm([termstr, fd])
    482514
    483    Initializes the terminal.  *termstr* is a string giving the terminal name; if
    484    omitted, the value of the TERM environment variable will be used.  *fd* is the
     515   Initialize the terminal.  *termstr* is a string giving the terminal name; if
     516   omitted, the value of the :envvar:`TERM` environment variable will be used.  *fd* is the
    485517   file descriptor to which any initialization sequences will be sent; if not
    486518   supplied, the file descriptor for ``sys.stdout`` will be used.
     
    502534.. function:: termattrs()
    503535
    504    Returns a logical OR of all video attributes supported by the terminal.  This
     536   Return a logical OR of all video attributes supported by the terminal.  This
    505537   information is useful when a curses program needs complete control over the
    506538   appearance of the screen.
     
    509541.. function:: termname()
    510542
    511    Returns the value of the environment variable TERM, truncated to 14 characters.
     543   Return the value of the environment variable :envvar:`TERM`, truncated to 14 characters.
    512544
    513545
    514546.. function:: tigetflag(capname)
    515547
    516    Returns the value of the Boolean capability corresponding to the terminfo
     548   Return the value of the Boolean capability corresponding to the terminfo
    517549   capability name *capname*.  The value ``-1`` is returned if *capname* is not a
    518550   Boolean capability, or ``0`` if it is canceled or absent from the terminal
     
    522554.. function:: tigetnum(capname)
    523555
    524    Returns the value of the numeric capability corresponding to the terminfo
     556   Return the value of the numeric capability corresponding to the terminfo
    525557   capability name *capname*.  The value ``-2`` is returned if *capname* is not a
    526558   numeric capability, or ``-1`` if it is canceled or absent from the terminal
     
    530562.. function:: tigetstr(capname)
    531563
    532    Returns the value of the string capability corresponding to the terminfo
     564   Return the value of the string capability corresponding to the terminfo
    533565   capability name *capname*.  ``None`` is returned if *capname* is not a string
    534566   capability, or is canceled or absent from the terminal description.
     
    537569.. function:: tparm(str[,...])
    538570
    539    Instantiates the string *str* with the supplied parameters, where *str* should
    540    be a parameterized string obtained from the terminfo  database.  E.g.
    541    ``tparm(tigetstr("cup"), 5, 3)`` could result in  ``'\033[6;4H'``, the exact
     571   Instantiate the string *str* with the supplied parameters, where *str* should
     572   be a parameterized string obtained from the terminfo database.  E.g.
     573   ``tparm(tigetstr("cup"), 5, 3)`` could result in ``'\033[6;4H'``, the exact
    542574   result depending on terminal type.
    543575
     
    545577.. function:: typeahead(fd)
    546578
    547    Specifies that the file descriptor *fd* be used for typeahead checking.  If *fd*
     579   Specify that the file descriptor *fd* be used for typeahead checking.  If *fd*
    548580   is ``-1``, then no typeahead checking is done.
    549581
     
    557589.. function:: unctrl(ch)
    558590
    559    Returns a string which is a printable representation of the character *ch*.
     591   Return a string which is a printable representation of the character *ch*.
    560592   Control characters are displayed as a caret followed by the character, for
    561593   example as ``^C``. Printing characters are left as they are.
     
    580612
    581613   If used, this function should be called before :func:`initscr` or newterm are
    582    called.  When *flag* is false, the values of lines and columns specified in the
     614   called.  When *flag* is ``False``, the values of lines and columns specified in the
    583615   terminfo database will be used, even if environment variables :envvar:`LINES`
    584616   and :envvar:`COLUMNS` (used by default) are set, or if curses is running in a
     
    596628
    597629
     630.. function:: wrapper(func, ...)
     631
     632   Initialize curses and call another callable object, *func*, which should be the
     633   rest of your curses-using application.  If the application raises an exception,
     634   this function will restore the terminal to a sane state before re-raising the
     635   exception and generating a traceback.  The callable object *func* is then passed
     636   the main window 'stdscr' as its first argument, followed by any other arguments
     637   passed to :func:`wrapper`.  Before calling *func*, :func:`wrapper` turns on
     638   cbreak mode, turns off echo, enables the terminal keypad, and initializes colors
     639   if the terminal has color support.  On exit (whether normally or by exception)
     640   it restores cooked mode, turns on echo, and disables the terminal keypad.
     641
     642
    598643.. _curses-window-objects:
    599644
     
    605650
    606651
    607 .. method:: window.addch([y, x,] ch[, attr])
     652.. method:: window.addch(ch[, attr])
     653            window.addch(y, x, ch[, attr])
    608654
    609655   .. note::
    610656
    611       A *character* means a C character (an ASCII code), rather then a Python
     657      A *character* means a C character (an ASCII code), rather than a Python
    612658      character (a string of length 1). (This note is true whenever the
    613659      documentation mentions a character.) The built-in :func:`ord` is handy for
     
    619665
    620666
    621 .. method:: window.addnstr([y, x,] str, n[, attr])
     667.. method:: window.addnstr(str, n[, attr])
     668            window.addnstr(y, x, str, n[, attr])
    622669
    623670   Paint at most *n* characters of the  string *str* at ``(y, x)`` with attributes
     
    625672
    626673
    627 .. method:: window.addstr([y, x,] str[, attr])
     674.. method:: window.addstr(str[, attr])
     675            window.addstr(y, x, str[, attr])
    628676
    629677   Paint the string *str* at ``(y, x)`` with attributes *attr*, overwriting
     
    651699.. method:: window.bkgd(ch[, attr])
    652700
    653    Sets the background property of the window to the character *ch*, with
     701   Set the background property of the window to the character *ch*, with
    654702   attributes *attr*.  The change is then applied to every character position in
    655703   that window:
     
    664712.. method:: window.bkgdset(ch[, attr])
    665713
    666    Sets the window's background.  A window's background consists of a character and
     714   Set the window's background.  A window's background consists of a character and
    667715   any combination of attributes.  The attribute part of the background is combined
    668716   (OR'ed) with all non-blank characters that are written into the window.  Both
     
    709757
    710758   Similar to :meth:`border`, but both *ls* and *rs* are *vertch* and both *ts* and
    711    bs are *horch*.  The default corner characters are always used by this function.
    712 
    713 
    714 .. method:: window.chgat([y, x, ] [num,] attr)
    715 
    716    Sets the attributes of *num* characters at the current cursor position, or at
     759   *bs* are *horch*.  The default corner characters are always used by this function.
     760
     761
     762.. method:: window.chgat(attr)
     763            window.chgat(num, attr)
     764            window.chgat(y, x, attr)
     765            window.chgat(y, x, num, attr)
     766
     767   Set the attributes of *num* characters at the current cursor position, or at
    717768   position ``(y, x)`` if supplied. If no value of *num* is given or *num* = -1,
    718769   the attribute will  be set on all the characters to the end of the line.  This
     
    724775.. method:: window.clear()
    725776
    726    Like :meth:`erase`, but also causes the whole window to be repainted upon next
     777   Like :meth:`erase`, but also cause the whole window to be repainted upon next
    727778   call to :meth:`refresh`.
    728779
     
    747798.. method:: window.cursyncup()
    748799
    749    Updates the current cursor position of all the ancestors of the window to
     800   Update the current cursor position of all the ancestors of the window to
    750801   reflect the current cursor position of the window.
    751802
     
    758809.. method:: window.deleteln()
    759810
    760    Delete the line under the cursor. All following lines are moved up by 1 line.
    761 
    762 
    763 .. method:: window.derwin([nlines, ncols,] begin_y, begin_x)
     811   Delete the line under the cursor. All following lines are moved up by one line.
     812
     813
     814.. method:: window.derwin(begin_y, begin_x)
     815            window.derwin(nlines, ncols, begin_y, begin_x)
    764816
    765817   An abbreviation for "derive window", :meth:`derwin` is the same as calling
    766818   :meth:`subwin`, except that *begin_y* and *begin_x* are relative to the origin
    767    of the window, rather than relative to the entire screen.  Returns a window
     819   of the window, rather than relative to the entire screen.  Return a window
    768820   object for the derived window.
    769821
     
    777829.. method:: window.enclose(y, x)
    778830
    779    Tests whether the given pair of screen-relative character-cell coordinates are
    780    enclosed by the given window, returning true or false.  It is useful for
     831   Test whether the given pair of screen-relative character-cell coordinates are
     832   enclosed by the given window, returning ``True`` or ``False``.  It is useful for
    781833   determining what subset of the screen windows enclose the location of a mouse
    782834   event.
     
    791843
    792844   Return a tuple ``(y, x)`` of co-ordinates of upper-left corner.
     845
     846
     847.. method:: window.getbkgd()
     848
     849   Return the given window's current background character/attribute pair.
    793850
    794851
     
    815872.. method:: window.getparyx()
    816873
    817    Returns the beginning coordinates of this window relative to its parent window
    818    into two integer variables y and x.  Returns ``-1,-1`` if this window has no
     874   Return the beginning coordinates of this window relative to its parent window
     875   into two integer variables y and x.  Return ``-1, -1`` if this window has no
    819876   parent.
    820877
     
    831888
    832889
    833 .. method:: window.hline([y, x,] ch, n)
     890.. method:: window.hline(ch, n)
     891            window.hline(y, x, ch, n)
    834892
    835893   Display a horizontal line starting at ``(y, x)`` with length *n* consisting of
     
    839897.. method:: window.idcok(flag)
    840898
    841    If *flag* is false, curses no longer considers using the hardware insert/delete
    842    character feature of the terminal; if *flag* is true, use of character insertion
     899   If *flag* is ``False``, curses no longer considers using the hardware insert/delete
     900   character feature of the terminal; if *flag* is ``True``, use of character insertion
    843901   and deletion is enabled.  When curses is first initialized, use of character
    844902   insert/delete is enabled by default.
     
    853911.. method:: window.immedok(flag)
    854912
    855    If *flag* is true, any change in the window image automatically causes the
     913   If *flag* is ``True``, any change in the window image automatically causes the
    856914   window to be refreshed; you no longer have to call :meth:`refresh` yourself.
    857915   However, it may degrade performance considerably, due to repeated calls to
     
    865923
    866924
    867 .. method:: window.insch([y, x,] ch[, attr])
     925.. method:: window.insch(ch[, attr])
     926            window.insch(y, x, ch[, attr])
    868927
    869928   Paint character *ch* at ``(y, x)`` with attributes *attr*, moving the line from
     
    873932.. method:: window.insdelln(nlines)
    874933
    875    Inserts *nlines* lines into the specified window above the current line.  The
     934   Insert *nlines* lines into the specified window above the current line.  The
    876935   *nlines* bottom lines are lost.  For negative *nlines*, delete *nlines* lines
    877936   starting with the one under the cursor, and move the remaining lines up.  The
     
    882941.. method:: window.insertln()
    883942
    884    Insert a blank line under the cursor. All following lines are moved down by 1
     943   Insert a blank line under the cursor. All following lines are moved down by one
    885944   line.
    886945
    887946
    888 .. method:: window.insnstr([y, x,] str, n [, attr])
     947.. method:: window.insnstr(str, n[, attr])
     948            window.insnstr(y, x, str, n[, attr])
    889949
    890950   Insert a character string (as many characters as will fit on the line) before
     
    895955
    896956
    897 .. method:: window.insstr([y, x, ] str [, attr])
     957.. method:: window.insstr(str[, attr])
     958            window.insstr(y, x, str[, attr])
    898959
    899960   Insert a character string (as many characters as will fit on the line) before
     
    903964
    904965
    905 .. method:: window.instr([y, x] [, n])
    906 
    907    Returns a string of characters, extracted from the window starting at the
     966.. method:: window.instr([n])
     967            window.instr(y, x[, n])
     968
     969   Return a string of characters, extracted from the window starting at the
    908970   current cursor position, or at *y*, *x* if specified. Attributes are stripped
    909    from the characters.  If *n* is specified, :meth:`instr` returns return a string
     971   from the characters.  If *n* is specified, :meth:`instr` returns a string
    910972   at most *n* characters long (exclusive of the trailing NUL).
    911973
     
    913975.. method:: window.is_linetouched(line)
    914976
    915    Returns true if the specified line was modified since the last call to
    916    :meth:`refresh`; otherwise returns false.  Raises a :exc:`curses.error`
     977   Return ``True`` if the specified line was modified since the last call to
     978   :meth:`refresh`; otherwise return ``False``.  Raise a :exc:`curses.error`
    917979   exception if *line* is not valid for the given window.
    918980
     
    920982.. method:: window.is_wintouched()
    921983
    922    Returns true if the specified window was modified since the last call to
    923    :meth:`refresh`; otherwise returns false.
     984   Return ``True`` if the specified window was modified since the last call to
     985   :meth:`refresh`; otherwise return ``False``.
    924986
    925987
     
    9471009.. method:: window.mvderwin(y, x)
    9481010
    949    Moves the window inside its parent window.  The screen-relative parameters of
     1011   Move the window inside its parent window.  The screen-relative parameters of
    9501012   the window are not changed.  This routine is used to display different parts of
    9511013   the parent window at the same physical position on the screen.
     
    10051067.. method:: window.putwin(file)
    10061068
    1007    Writes all data associated with the window into the provided file object.  This
     1069   Write all data associated with the window into the provided file object.  This
    10081070   information can be later retrieved using the :func:`getwin` function.
    10091071
     
    10111073.. method:: window.redrawln(beg, num)
    10121074
    1013    Indicates that the *num* screen lines, starting at line *beg*, are corrupted and
     1075   Indicate that the *num* screen lines, starting at line *beg*, are corrupted and
    10141076   should be completely redrawn on the next :meth:`refresh` call.
    10151077
     
    10171079.. method:: window.redrawwin()
    10181080
    1019    Touches the entire window, causing it to be completely redrawn on the next
     1081   Touch the entire window, causing it to be completely redrawn on the next
    10201082   :meth:`refresh` call.
    10211083
     
    10381100
    10391101
     1102.. method:: window.resize(nlines, ncols)
     1103
     1104   Reallocate storage for a curses window to adjust its dimensions to the
     1105   specified values.  If either dimension is larger than the current values, the
     1106   window's data is filled with blanks that have the current background
     1107   rendition (as set by :meth:`bkgdset`) merged into them.
     1108
     1109
    10401110.. method:: window.scroll([lines=1])
    10411111
     
    10451115.. method:: window.scrollok(flag)
    10461116
    1047    Controls what happens when the cursor of a window is moved off the edge of the
     1117   Control what happens when the cursor of a window is moved off the edge of the
    10481118   window or scrolling region, either as a result of a newline action on the bottom
    10491119   line, or typing the last character of the last line.  If *flag* is false, the
     
    10701140
    10711141
    1072 .. method:: window.subpad([nlines, ncols,] begin_y, begin_x)
     1142.. method:: window.subpad(begin_y, begin_x)
     1143            window.subpad(nlines, ncols, begin_y, begin_x)
    10731144
    10741145   Return a sub-window, whose upper-left corner is at ``(begin_y, begin_x)``, and
     
    10761147
    10771148
    1078 .. method:: window.subwin([nlines, ncols,] begin_y, begin_x)
     1149.. method:: window.subwin(begin_y, begin_x)
     1150            window.subwin(nlines, ncols, begin_y, begin_x)
    10791151
    10801152   Return a sub-window, whose upper-left corner is at ``(begin_y, begin_x)``, and
     
    10871159.. method:: window.syncdown()
    10881160
    1089    Touches each location in the window that has been touched in any of its ancestor
     1161   Touch each location in the window that has been touched in any of its ancestor
    10901162   windows.  This routine is called by :meth:`refresh`, so it should almost never
    10911163   be necessary to call it manually.
     
    10941166.. method:: window.syncok(flag)
    10951167
    1096    If called with *flag* set to true, then :meth:`syncup` is called automatically
     1168   If called with *flag* set to ``True``, then :meth:`syncup` is called automatically
    10971169   whenever there is a change in the window.
    10981170
     
    11001172.. method:: window.syncup()
    11011173
    1102    Touches all locations in ancestors of the window that have been changed in  the
     1174   Touch all locations in ancestors of the window that have been changed in  the
    11031175   window.
    11041176
     
    11061178.. method:: window.timeout(delay)
    11071179
    1108    Sets blocking or non-blocking read behavior for the window.  If *delay* is
     1180   Set blocking or non-blocking read behavior for the window.  If *delay* is
    11091181   negative, blocking read is used (which will wait indefinitely for input).  If
    11101182   *delay* is zero, then non-blocking read is used, and -1 will be returned by
     
    11291201.. method:: window.untouchwin()
    11301202
    1131    Marks all lines in  the  window  as unchanged since the last call to
     1203   Mark all lines in  the  window  as unchanged since the last call to
    11321204   :meth:`refresh`.
    11331205
    11341206
    1135 .. method:: window.vline([y, x,] ch, n)
     1207.. method:: window.vline(ch, n)
     1208            window.vline(y, x, ch, n)
    11361209
    11371210   Display a vertical line starting at ``(y, x)`` with length *n* consisting of the
     
    11761249+------------------+-------------------------------+
    11771250| ``A_NORMAL``     | Normal attribute.             |
     1251+------------------+-------------------------------+
     1252| ``A_REVERSE``    | Reverse background and        |
     1253|                  | foreground colors.            |
    11781254+------------------+-------------------------------+
    11791255| ``A_STANDOUT``   | Standout mode.                |
     
    15851661      is done on the result. This method returns the window contents as a
    15861662      string; whether blanks in the window are included is affected by the
    1587       :attr:`stripspaces` member.
     1663      :attr:`stripspaces` attribute.
    15881664
    15891665
     
    16511727   .. method:: gather()
    16521728
    1653       This method returns the window contents as a string; whether blanks in the
     1729      Return the window contents as a string; whether blanks in the
    16541730      window are included is affected by the :attr:`stripspaces` member.
    16551731
     
    16571733   .. attribute:: stripspaces
    16581734
    1659       This data member is a flag which controls the interpretation of blanks in
     1735      This attribute is a flag which controls the interpretation of blanks in
    16601736      the window.  When it is on, trailing blanks on each line are ignored; any
    16611737      cursor motion that would land the cursor on a trailing blank goes to the
     
    16631739      contents are gathered.
    16641740
    1665 
    1666 :mod:`curses.wrapper` --- Terminal handler for curses programs
    1667 ==============================================================
    1668 
    1669 .. module:: curses.wrapper
    1670    :synopsis: Terminal configuration wrapper for curses programs.
    1671 .. moduleauthor:: Eric Raymond <esr@thyrsus.com>
    1672 .. sectionauthor:: Eric Raymond <esr@thyrsus.com>
    1673 
    1674 
    1675 .. versionadded:: 1.6
    1676 
    1677 This module supplies one function, :func:`wrapper`, which runs another function
    1678 which should be the rest of your curses-using application.  If the application
    1679 raises an exception, :func:`wrapper` will restore the terminal to a sane state
    1680 before re-raising the exception and generating a traceback.
    1681 
    1682 
    1683 .. function:: wrapper(func, ...)
    1684 
    1685    Wrapper function that initializes curses and calls another function, *func*,
    1686    restoring normal keyboard/screen behavior on error. The callable object *func*
    1687    is then passed the main window 'stdscr' as its first argument, followed by any
    1688    other arguments passed to :func:`wrapper`.
    1689 
    1690 Before calling the hook function, :func:`wrapper` turns on cbreak mode, turns
    1691 off echo, enables the terminal keypad, and initializes colors if the terminal
    1692 has color support.  On exit (whether normally or by exception) it restores
    1693 cooked mode, turns on echo, and disables the terminal keypad.
    1694 
Note: See TracChangeset for help on using the changeset viewer.