Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
Kirill Smelkov
cpython
Commits
491eb6a1
Commit
491eb6a1
authored
13 years ago
by
R David Murray
Browse files
Options
Download
Email Patches
Plain Diff
#6771: fix docs: curses.wrapper is exposed as a function, not a module
Patch by July Tikhonov.
parent
f1138bb1
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
34 deletions
+13
-34
Doc/library/curses.rst
Doc/library/curses.rst
+13
-34
No files found.
Doc/library/curses.rst
View file @
491eb6a1
...
...
@@ -44,10 +44,6 @@ Linux and the BSD variants of Unix.
Module :mod:`curses.textpad`
Editable text widget for curses supporting :program:`Emacs`\ -like bindings.
Module :mod:`curses.wrapper`
Convenience function to ensure proper terminal setup and resetting on
application entry and exit.
:ref:`curses-howto`
Tutorial material on using curses with Python, by Andrew Kuchling and Eric
Raymond.
...
...
@@ -595,6 +591,19 @@ The module :mod:`curses` defines the following functions:
foreground color on the default background.
.. function:: wrapper(func, ...)
Initialize curses and call another callable object, *func*, which should be the
rest of your curses-using application. If the application raises an exception,
this function will restore the terminal to a sane state before re-raising the
exception and generating a traceback. The callable object *func* is then passed
the main window 'stdscr' as its first argument, followed by any other arguments
passed to :func:`wrapper`. Before calling *func*, :func:`wrapper` turns on
cbreak mode, turns off echo, enables the terminal keypad, and initializes colors
if the terminal has color support. On exit (whether normally or by exception)
it restores cooked mode, turns on echo, and disables the terminal keypad.
.. _curses-window-objects:
Window Objects
...
...
@@ -1665,33 +1674,3 @@ You can instantiate a :class:`Textbox` object as follows:
end of that line instead, and trailing blanks are stripped when the window
contents are gathered.
:mod:`curses.wrapper` --- Terminal handler for curses programs
==============================================================
.. module:: curses.wrapper
:synopsis: Terminal configuration wrapper for curses programs.
.. moduleauthor:: Eric Raymond <esr@thyrsus.com>
.. sectionauthor:: Eric Raymond <esr@thyrsus.com>
.. versionadded:: 1.6
This module supplies one function, :func:`wrapper`, which runs another function
which should be the rest of your curses-using application. If the application
raises an exception, :func:`wrapper` will restore the terminal to a sane state
before re-raising the exception and generating a traceback.
.. function:: wrapper(func, ...)
Wrapper function that initializes curses and calls another function, *func*,
restoring normal keyboard/screen behavior on error. The callable object *func*
is then passed the main window 'stdscr' as its first argument, followed by any
other arguments passed to :func:`wrapper`.
Before calling the hook function, :func:`wrapper` turns on cbreak mode, turns
off echo, enables the terminal keypad, and initializes colors if the terminal
has color support. On exit (whether normally or by exception) it restores
cooked mode, turns on echo, and disables the terminal keypad.
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment