6.12.1 Constants and Functions

The curses module defines the following data members:

version
A string representing the current version of the module.

A_NORMAL
Normal attribute.

A_STANDOUT
Standout mode.

A_UNDERLINE
Underline mode.

A_BLINK
Blink mode.

A_DIM
Dim mode.

A_BOLD
Bold mode.

A_ALTCHARSET
Alternate character set mode.

KEY_*
Names for various keys. The exact names available are system dependant.

ACS_*
Names for various characters: ACS_ULCORNER, ACS_LLCORNER, ACS_URCORNER, ACS_LRCORNER, ACS_RTEE, ACS_LTEE, ACS_BTEE, ACS_TTEE, ACS_HLINE, ACS_VLINE, ACS_PLUS, ACS_S1, ACS_S9, ACS_DIAMOND, ACS_CKBOARD, ACS_DEGREE, ACS_PLMINUS, ACS_BULLET, ACS_LARROW, ACS_RARROW, ACS_DARROW.

Note: These are available only after initscr() has been called.

The module curses defines the following exception:

error
Curses function returned an error status.

Note: Whenever x or y arguments to a function or a method are optional, they default to the current cursor location. Whenever attr is optional, it defaults to A_NORMAL.

The module curses defines the following functions:

initscr ()
Initialize the library. Returns a WindowObject which represents the whole screen.

endwin ()
De-initialize the library, and return terminal to normal status.

isendwin ()
Returns true if endwin() has been called.

doupdate ()
Update the screen.

newwin ([nlines, ncols,] begin_y, begin_x)
Return a new window, whose left-upper corner is at (begin_y, begin_x), and whose height/width is nlines/ncols.

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

beep ()
Emit a short sound.

flash ()
Flash the screen.

ungetch (ch)
Push ch so the next getch() will return it; ch is an integer specifying the character to be pushed. Note: only one ch can be pushed before getch() is called.

flushinp ()
Flush all input buffers.

cbreak ()
Enter cbreak mode.

nocbreak ()
Leave cbreak mode.

echo ()
Enter echo mode.

noecho ()
Leave echo mode.

nl ()
Enter nl mode.

nonl ()
Leave nl mode.

raw ()
Enter raw mode.

noraw ()
Leave raw mode.

meta (yes)
If yes is 1, allow 8-bit characters. If yes is 0, allow only 7-bit chars.

keyname (k)
Return the name of the key numbered k.


Send comments on this document to python-docs@python.org.