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:
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.
(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.
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 (e.g., 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 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.
(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.
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.
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.
None
is returned if
capname is not a string capability, or is canceled or absent
from the terminal description.
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.
^C
. Printing characters are left as they
are.