The module curses defines the following exception:
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:
) |
) |
) |
) |
color_number) |
0
and
COLORS. A 3-tuple is returned, containing the R,G,B values
for the given color, which will be between 0
(no component) and
1000
(maximum amount of component).
color_number) |
visibility) |
) |
) |
ms) |
) |
The virtual screen may be updated by a noutrefresh() call after write operations such as addstr() have been performed on a window. The normal refresh() call is simply noutrefresh() followed by doupdate(); if you have to update multiple windows, you can speed performance and perhaps reduce screen flicker by issuing noutrefresh() calls on all windows, followed by a single doupdate().
) |
) |
) |
) |
) |
) |
) |
(id, x, y, z, bstate)
.
id is an ID value used to distinguish multiple devices,
and x, y, z are the event's coordinates. (z
is currently unused.). bstate is an integer value whose bits
will be set to indicate the type of event, and will be the bitwise OR
of one or more of the following constants, where n is the button
number from 1 to 4:
BUTTONn_PRESSED,
BUTTONn_RELEASED,
BUTTONn_CLICKED,
BUTTONn_DOUBLE_CLICKED,
BUTTONn_TRIPLE_CLICKED,
BUTTON_SHIFT,
BUTTON_CTRL,
BUTTON_ALT.
) |
file) |
) |
) |
) |
ch) |
tenths) |
color_number, r, g, b) |
0
and COLORS. Each of r, g,
b, must be a value between 0
and 1000
. When
init_color() is used, all occurrences of that color on the
screen immediately change to the new definition. This function is a
no-op on most terminals; it is active only if
can_change_color() returns 1
.
pair_number, fg, bg) |
1
and COLOR_PAIRS - 1
(the 0
color
pair is wired to white on black and cannot be changed). The value of
fg and bg arguments must be between 0
and
COLORS. If the color-pair was previously initialized, the
screen is refreshed and all occurrences of that color-pair are changed
to the new definition.
) |
) |
k) |
) |
) |
yes) |
interval) |
mousemask) |
(availmask, oldmask)
.
availmask indicates which of the
specified mouse events can be reported; on complete failure it returns
0. oldmask is the previous value of the given window's mouse
event mask. If this function is never called, no mouse events are
ever reported.
ms) |
nlines, ncols) |
A pad is like a window, except that it is not restricted by the screen size, and is not necessarily associated with a particular part of the screen. Pads can be used when a large window is needed, and only a part of the window will be on the screen at one time. Automatic refreshes of pads (such as from scrolling or echoing of input) do not occur. The refresh() and noutrefresh() methods of a pad require 6 arguments to specify the part of the pad to be displayed and the location on the screen to be used for the display. The arguments are pminrow, pmincol, sminrow, smincol, smaxrow, smaxcol; the p arguments refer to the upper left corner of the pad region to be displayed and the s arguments define a clipping box on the screen within which the pad region is to be displayed.
[nlines, ncols,] begin_y, begin_x) |
(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.
) |
) |
) |
) |
addch('\n')
, which always does the equivalent of return and
line feed on the virtual screen). With translation off, curses can
sometimes speed up vertical motion a little; also, it will be able to
detect the return key on input.
) |
) |
pair_number) |
(fg, bg)
containing the colors for
the requested color pair. The value of pair_number must be
between 0
and COLOR_PAIRS - 1
.
attr) |
string) |
tputs(str, 1, putchar)
; emits the value of a
specified terminfo capability for the current terminal. Note that the
output of putp always goes to standard output.
[flag]) |
) |
) |
) |
y, x) |
[termstr, fd]) |
sys.stdout
will be used.
) |
start_color() initializes eight basic colors (black, red, green, yellow, blue, magenta, cyan, and white), and two global variables in the curses module, COLORS and COLOR_PAIRS, containing the maximum number of colors and color-pairs the terminal can support. It also restores the colors on the terminal to the values they had when the terminal was just turned on.
) |
) |
capname) |
-1
is
returned if capname is not a Boolean capability, or 0
if
it is canceled or absent from the terminal description.
capname) |
-2
is
returned if capname is not a numeric capability, or -1
if
it is canceled or absent from the terminal description.
capname) |
None
is returned if
capname is not a string capability, or is canceled or absent
from the terminal description.
str[,...]) |
tparm(tigetstr("cup"), 5, 3)
could result in
'\033[6;4H'
, the exact result depending on terminal type.
fd) |
-1
, then no typeahead checking is
done.
The curses library does ``line-breakout optimization'' by looking for typeahead periodically while updating the screen. If input is found, and it is coming from a tty, the current update is postponed until refresh or doupdate is called again, allowing faster response to commands typed in advance. This function allows specifying a different file descriptor for typeahead checking.
ch) |
^C
. Printing
characters are left as they are.
ch) |
id, x, y, z, bstate) |
flag) |
See About this document... for information on suggesting changes.