Fred Drake | a4070ce | 1999-06-21 21:13:09 +0000 | [diff] [blame] | 1 | \section{\module{curses} --- |
| 2 | Terminal independant console handling} |
| 3 | |
| 4 | \declaremodule{extension}{curses} |
| 5 | \sectionauthor{Moshe Zadka}{mzadka@geocities.com} |
| 6 | \modulesynopsis{An interface to the curses library.} |
| 7 | |
| 8 | The \module{curses} module provides an interface to the curses \UNIX{} |
| 9 | library, the de-facto standard for portable advanced terminal |
| 10 | handling. |
| 11 | |
| 12 | While curses is most widely used in the \UNIX{} environment, versions |
| 13 | are available for DOS, OS/2, and possibly other systems as well. The |
| 14 | extension module has not been tested with all available versions of |
| 15 | curses. |
| 16 | |
| 17 | \begin{seealso} |
| 18 | \seetext{Tutorial material on using curses with Python is available |
Fred Drake | 37f1574 | 1999-11-10 16:21:37 +0000 | [diff] [blame] | 19 | on the Python Web site as Andrew Kuchling's |
| 20 | \citetitle[http://www.python.org/doc/howto/curses/curses.html]{Curses |
Fred Drake | a4070ce | 1999-06-21 21:13:09 +0000 | [diff] [blame] | 21 | Programming with Python}, at |
| 22 | \url{http://www.python.org/doc/howto/curses/curses.html}.} |
| 23 | \end{seealso} |
| 24 | |
| 25 | |
Andrew M. Kuchling | f1dc5fa | 2000-05-23 16:46:04 +0000 | [diff] [blame] | 26 | \subsection{Functions \label{curses-functions}} |
Fred Drake | a4070ce | 1999-06-21 21:13:09 +0000 | [diff] [blame] | 27 | |
| 28 | The module \module{curses} defines the following exception: |
| 29 | \begin{excdesc}{error} |
| 30 | Curses function returned an error status. |
| 31 | \end{excdesc} |
| 32 | |
Fred Drake | 0bccd73 | 1999-06-23 17:28:01 +0000 | [diff] [blame] | 33 | \strong{Note:} Whenever \var{x} or \var{y} arguments to a function |
| 34 | or a method are optional, they default to the current cursor location. |
| 35 | Whenever \var{attr} is optional, it defaults to \constant{A_NORMAL}. |
| 36 | |
Fred Drake | a4070ce | 1999-06-21 21:13:09 +0000 | [diff] [blame] | 37 | The module \module{curses} defines the following functions: |
| 38 | |
Andrew M. Kuchling | f1dc5fa | 2000-05-23 16:46:04 +0000 | [diff] [blame] | 39 | \begin{funcdesc}{baudrate}{} |
| 40 | Returns the output speed of the terminal in bits per second. |
| 41 | \end{funcdesc} |
| 42 | |
| 43 | \begin{funcdesc}{beep}{} |
| 44 | Emit a short sound. |
| 45 | \end{funcdesc} |
| 46 | |
| 47 | \begin{funcdesc}{can_change_color}{} |
| 48 | Returns true or false, depending on whether the programmer can change |
| 49 | the colors displayed by the terminal. |
| 50 | \end{funcdesc} |
| 51 | |
| 52 | \begin{funcdesc}{cbreak}{} |
| 53 | Enter cbreak mode. |
| 54 | \end{funcdesc} |
| 55 | |
| 56 | \begin{funcdesc}{color_content}{color_number} |
| 57 | Returns the intensity of the red, green, and blue (RGB) components in |
| 58 | the color \var{color_number}, which must be between 0 and COLORS. A |
| 59 | 3-tuple is returned, containing the R,G,B values for the given color, |
| 60 | which will be between 0 (no component) and 1000 (maximum amount of |
| 61 | component). |
| 62 | \end{funcdesc} |
| 63 | |
| 64 | \begin{funcdesc}{color_pair}{color_number} |
| 65 | Returns the attribute value for displaying text in the specified |
| 66 | color. This attribute value can be combined with |
| 67 | \constant{A_STANDOUT}, \constant{A_REVERSE}, and the other |
| 68 | \constant{A_*} attributes. \function{pair_number()} is the counterpart to this function. |
| 69 | \end{funcdesc} |
| 70 | |
| 71 | \begin{funcdesc}{curs_set}{visibility} |
| 72 | Sets the cursor state. \var{visibility} can be set to 0, 1, or 2, for |
| 73 | invisible, normal, or very visible. If the terminal supports the |
| 74 | visibility requested, the previous cursor state is returned; |
| 75 | otherwise, an exception is raised. |
| 76 | \end{funcdesc} |
| 77 | |
| 78 | \begin{funcdesc}{def_prog_mode}{} |
| 79 | Saves the current terminal mode as the ``program'' mode, the mode when |
| 80 | the running program is using curses. (Its counterpart is the |
| 81 | ``shell'' mode, for when the program is not in curses.) Subsequent calls |
| 82 | to \function{reset_prog_mode()} will restore this mode. |
| 83 | \end{funcdesc} |
| 84 | |
| 85 | \begin{funcdesc}{def_shell_mode}{} |
| 86 | Saves the current terminal mode as the ``shell'' mode, the mode when |
| 87 | the running program is not using curses. (Its counterpart is the |
| 88 | ``program'' mode, when the program is using curses capabilities.) |
| 89 | Subsequent calls |
| 90 | to \function{reset_shell_mode()} will restore this mode. |
| 91 | \end{funcdesc} |
| 92 | |
| 93 | \begin{funcdesc}{delay_output}{ms} |
| 94 | Inserts an \var{ms} millisecond pause in output. |
| 95 | \end{funcdesc} |
| 96 | |
| 97 | \begin{funcdesc}{doupdate}{} |
| 98 | Update the screen. |
| 99 | \end{funcdesc} |
| 100 | |
| 101 | \begin{funcdesc}{echo}{} |
| 102 | Enter echo mode. |
Fred Drake | a4070ce | 1999-06-21 21:13:09 +0000 | [diff] [blame] | 103 | \end{funcdesc} |
| 104 | |
| 105 | \begin{funcdesc}{endwin}{} |
| 106 | De-initialize the library, and return terminal to normal status. |
| 107 | \end{funcdesc} |
| 108 | |
Andrew M. Kuchling | f1dc5fa | 2000-05-23 16:46:04 +0000 | [diff] [blame] | 109 | \begin{funcdesc}{erasechar}{} |
| 110 | Returns the user's current erase character. |
| 111 | \end{funcdesc} |
| 112 | |
| 113 | \begin{funcdesc}{filter}{} |
| 114 | The \function{filter()} routine, if used, must be called before |
| 115 | \function{initscr()} is called. |
| 116 | |
| 117 | The effect is that, during those calls, LINES is set to 1; the |
| 118 | capabilities clear, cup, cud, cud1, cuu1, cuu, vpa are disabled; and |
| 119 | the home string is set to the value of cr. |
| 120 | \end{funcdesc} |
| 121 | |
| 122 | \begin{funcdesc}{flash}{} |
| 123 | Flash the screen. |
| 124 | \end{funcdesc} |
| 125 | |
| 126 | \begin{funcdesc}{flushinp}{} |
| 127 | Flush all input buffers. |
| 128 | \end{funcdesc} |
| 129 | |
| 130 | \begin{funcdesc}{getsyx}{} |
| 131 | Returns the current coordinates of the virtual screen cursor in y and |
| 132 | x. If leaveok is currently true, then -1,-1 is returned. |
| 133 | \end{funcdesc} |
| 134 | |
| 135 | \begin{funcdesc}{getwin}{file} |
| 136 | Reads window related data stored in the file by an earlier |
| 137 | \function{putwin()} call. The routine then creates and initializes a |
| 138 | new window using that data, returning the new window object. |
| 139 | \end{funcdesc} |
| 140 | |
| 141 | \begin{funcdesc}{has_colors}{} |
| 142 | Returns true if the terminal can manipulate colors; otherwise, it |
| 143 | returns false. |
| 144 | \end{funcdesc} |
| 145 | |
| 146 | \begin{funcdesc}{has_ic}{} |
| 147 | Returns true if the terminal has insert- and delete- character |
| 148 | capabilities. |
| 149 | \end{funcdesc} |
| 150 | |
| 151 | \begin{funcdesc}{has_il}{} |
| 152 | Returns true if the terminal has insert- and |
| 153 | delete-line capabilities, or can simulate them using |
| 154 | scrolling regions. |
| 155 | \end{funcdesc} |
| 156 | |
| 157 | \begin{funcdesc}{has_key}{ch} |
| 158 | Takes a key value \var{ch}, and returns true if the current terminal |
| 159 | type recognizes a key with that value. |
| 160 | \end{funcdesc} |
| 161 | |
| 162 | \begin{funcdesc}{halfdelay}{tenths} |
| 163 | Used for half-delay mode, which is similar to cbreak mode in that |
| 164 | characters typed by the user are immediately available to the program. |
| 165 | However, after blocking for \var{tenths} tenths of seconds, an |
| 166 | exception is raised if nothing has been typed. The value of |
| 167 | \var{tenths} must be a number between 1 and 255. Use nocbreak to |
| 168 | leave half-delay mode. |
| 169 | \end{funcdesc} |
| 170 | |
| 171 | \begin{funcdesc}{init_color}{color_number, r, g, b} |
| 172 | Changes the definition of a color, taking the number of the color to |
| 173 | be changed followed by three RGB values (for the amounts of red, |
| 174 | green, and blue components). The value of \var{color_number} must be |
| 175 | between 0 and COLORS. Each of \var{r}, \var{g}, \var{b}, must be a |
| 176 | value between 0 and 1000. When \function{init_color()} is used, all |
| 177 | occurrences of that color on the screen immediately change to the new |
| 178 | definition. |
| 179 | \end{funcdesc} |
| 180 | |
| 181 | \begin{funcdesc}{init_pair}{pair_number, fg, bg} |
| 182 | Changes the definition of a color-pair. It takes three arguments: the |
| 183 | number of the color-pair to be changed, the foreground color number, |
| 184 | and the background color number. The value of \var{pair_number} must |
| 185 | be between 1 and COLOR_PAIRS-1 (the 0 color pair is wired to white on |
| 186 | black and cannot be changed). The value of \var{fg} and \var{bg} |
| 187 | arguments must be between 0 and COLORS. If the color-pair was |
| 188 | previously initialized, the screen is refreshed and all occurrences of |
| 189 | that color-pair are changed to the new definition. |
| 190 | \end{funcdesc} |
| 191 | |
| 192 | \begin{funcdesc}{initscr}{} |
| 193 | Initialize the library. Returns a \class{WindowObject} which represents |
| 194 | the whole screen. |
| 195 | \end{funcdesc} |
| 196 | |
Fred Drake | a4070ce | 1999-06-21 21:13:09 +0000 | [diff] [blame] | 197 | \begin{funcdesc}{isendwin}{} |
| 198 | Returns true if \function{endwin()} has been called. |
| 199 | \end{funcdesc} |
| 200 | |
Andrew M. Kuchling | f1dc5fa | 2000-05-23 16:46:04 +0000 | [diff] [blame] | 201 | \begin{funcdesc}{keyname}{k} |
| 202 | Return the name of the key numbered \var{k}. |
| 203 | \end{funcdesc} |
| 204 | |
| 205 | \begin{funcdesc}{killchar}{} |
| 206 | Returns the user's current line kill character. |
| 207 | \end{funcdesc} |
| 208 | |
| 209 | \begin{funcdesc}{longname}{} |
| 210 | Returns a string containing a verbose description of the current |
| 211 | terminal. The maximum length of a verbose description is 128 |
| 212 | characters. It is defined only after the call to |
| 213 | \function{initscr()}. |
| 214 | \end{funcdesc} |
| 215 | |
| 216 | \begin{funcdesc}{meta}{yes} |
| 217 | If \var{yes} is 1, allow 8-bit characters. If \var{yes} is 0, |
| 218 | allow only 7-bit chars. |
| 219 | \end{funcdesc} |
| 220 | |
| 221 | \begin{funcdesc}{newpad}{nlines, ncols} |
| 222 | Creates and returns a pointer to a new pad data structure with the |
| 223 | given number of lines and columns. A pad is returned as a |
| 224 | window object. |
| 225 | |
| 226 | A pad is like a window, |
| 227 | except that it is not restricted by the screen size, and is not |
| 228 | necessarily associated with a particular part of the screen. |
| 229 | Pads can be used when a large window is needed, and only a part |
| 230 | of the window will be on the screen at one time. Automatic |
| 231 | refreshes of pads (e.g., from scrolling or echoing of |
| 232 | input) do not occur. It is not legal to call wrefresh |
| 233 | with a pad as an argument; the routines prefresh or |
| 234 | pnoutrefresh should be called instead. Note that these |
| 235 | routines require additional parameters to specify the part of |
| 236 | the pad to be displayed and the location on the screen to be |
| 237 | used for the display. |
| 238 | |
Fred Drake | a4070ce | 1999-06-21 21:13:09 +0000 | [diff] [blame] | 239 | \end{funcdesc} |
| 240 | |
| 241 | \begin{funcdesc}{newwin}{\optional{nlines, ncols,} begin_y, begin_x} |
| 242 | Return a new window, whose left-upper corner is at |
| 243 | \code{(\var{begin_y}, \var{begin_x})}, and whose height/width is |
Fred Drake | 0bccd73 | 1999-06-23 17:28:01 +0000 | [diff] [blame] | 244 | \var{nlines}/\var{ncols}. |
| 245 | |
| 246 | By default, the window will extend from the |
Fred Drake | a4070ce | 1999-06-21 21:13:09 +0000 | [diff] [blame] | 247 | specified position to the lower right corner of the screen. |
| 248 | \end{funcdesc} |
| 249 | |
Andrew M. Kuchling | f1dc5fa | 2000-05-23 16:46:04 +0000 | [diff] [blame] | 250 | \begin{funcdesc}{nl}{} |
| 251 | Enter nl mode. |
Fred Drake | a4070ce | 1999-06-21 21:13:09 +0000 | [diff] [blame] | 252 | \end{funcdesc} |
| 253 | |
| 254 | \begin{funcdesc}{nocbreak}{} |
| 255 | Leave cbreak mode. |
| 256 | \end{funcdesc} |
| 257 | |
Fred Drake | a4070ce | 1999-06-21 21:13:09 +0000 | [diff] [blame] | 258 | \begin{funcdesc}{noecho}{} |
| 259 | Leave echo mode. |
| 260 | \end{funcdesc} |
| 261 | |
Fred Drake | a4070ce | 1999-06-21 21:13:09 +0000 | [diff] [blame] | 262 | \begin{funcdesc}{nonl}{} |
| 263 | Leave nl mode. |
| 264 | \end{funcdesc} |
| 265 | |
Andrew M. Kuchling | f1dc5fa | 2000-05-23 16:46:04 +0000 | [diff] [blame] | 266 | \begin{funcdesc}{noqiflush}{} |
| 267 | When the noqiflush routine is used, normal flush of input and |
| 268 | output queues associated with the INTR, QUIT and SUSP |
| 269 | characters will not be done. You may want to call |
| 270 | \function{noqiflush()} in a signal handler if you want output |
| 271 | to continue as though the interrupt had not occurred, after the |
| 272 | handler exits. |
Fred Drake | a4070ce | 1999-06-21 21:13:09 +0000 | [diff] [blame] | 273 | \end{funcdesc} |
| 274 | |
| 275 | \begin{funcdesc}{noraw}{} |
| 276 | Leave raw mode. |
| 277 | \end{funcdesc} |
| 278 | |
Andrew M. Kuchling | f1dc5fa | 2000-05-23 16:46:04 +0000 | [diff] [blame] | 279 | \begin{funcdesc}{pair_content}{pair_number} |
| 280 | Returns a tuple \var{(fg,bg)} containing the colors for the requested |
| 281 | color pair. The value of \var{pair_number} must be between 0 and |
| 282 | COLOR_PAIRS-1. |
Fred Drake | a4070ce | 1999-06-21 21:13:09 +0000 | [diff] [blame] | 283 | \end{funcdesc} |
| 284 | |
Andrew M. Kuchling | f1dc5fa | 2000-05-23 16:46:04 +0000 | [diff] [blame] | 285 | \begin{funcdesc}{pair_number}{attr} |
| 286 | Returns the number of the color-pair set by the attribute value \var{attr}. |
| 287 | \function{color_pair()} is the counterpart to this function. |
Fred Drake | a4070ce | 1999-06-21 21:13:09 +0000 | [diff] [blame] | 288 | \end{funcdesc} |
| 289 | |
Andrew M. Kuchling | f1dc5fa | 2000-05-23 16:46:04 +0000 | [diff] [blame] | 290 | \begin{funcdesc}{putp}{string} |
| 291 | Equivalent to \code{tputs(str, 1, putchar)}. Note that the output of putp always |
| 292 | goes to standard output. |
| 293 | \end{funcdesc} |
| 294 | |
| 295 | \begin{funcdesc}{qiflush}{ \optional{flag} } |
| 296 | If \var{flag} is false, the effect is the same as calling |
| 297 | \function{noqiflush()}. If \var{flag} is true, or no argument is |
| 298 | provided, the queues will be flushed when these control characters are |
| 299 | read. |
| 300 | \end{funcdesc} |
| 301 | |
| 302 | \begin{funcdesc}{raw}{} |
| 303 | Enter raw mode. |
| 304 | \end{funcdesc} |
| 305 | |
| 306 | \begin{funcdesc}{reset_prog_mode}{} |
| 307 | Restores the terminal to ``program'' mode, as previously saved |
| 308 | by \function{def_prog_mode()}. |
| 309 | \end{funcdesc} |
| 310 | |
| 311 | \begin{funcdesc}{reset_shell_mode}{} |
| 312 | Restores the terminal to ``shell'' mode, as previously saved |
| 313 | by \function{def_shell_mode()}. |
| 314 | \end{funcdesc} |
| 315 | |
| 316 | \begin{funcdesc}{setsyx}{y, x} |
| 317 | Sets the virtual screen cursor to \var{y}, \var{x}. |
| 318 | If \var{y} and \var{x} are both -1, then leaveok is set. |
| 319 | \end{funcdesc} |
| 320 | |
| 321 | \begin{funcdesc}{start_color}{} |
| 322 | Must be called if the programmer wants to use colors, and before any |
| 323 | other color manipulation routine is called. It is good |
| 324 | practice to call this routine right after \function{initscr()}. |
| 325 | |
| 326 | \function{start_color()} initializes eight basic colors (black, red, |
| 327 | green, yellow, blue, magenta, cyan, and white), and two global |
| 328 | variables in the \module{curses} module, COLORS and COLOR_PAIRS, |
| 329 | containing the maximum number of colors and color-pairs the terminal |
| 330 | can support. It also restores the colors on the terminal to the |
| 331 | values they had when the terminal was just turned on. |
| 332 | \end{funcdesc} |
| 333 | |
| 334 | \begin{funcdesc}{termattrs}{} |
| 335 | Returns a logical OR of all video attributes supported by the |
| 336 | terminal. This information is useful when a curses program needs |
| 337 | complete control over the appearance of the screen. |
| 338 | \end{funcdesc} |
| 339 | |
| 340 | \begin{funcdesc}{termname}{} |
| 341 | Returns the value of the environment variable TERM, truncated to 14 |
| 342 | characters. |
| 343 | \end{funcdesc} |
| 344 | |
| 345 | \begin{funcdesc}{unctrl}{ch} |
| 346 | Returns a string which is a printable representation of the character |
| 347 | \var{ch}. Control characters are displayed as a caret followed by the |
| 348 | character, for example as \verb|^C|. Printing characters are left as they |
| 349 | are. |
| 350 | \end{funcdesc} |
| 351 | |
| 352 | \begin{funcdesc}{ungetch}{ch} |
| 353 | Push \var{ch} so the next \method{getch()} will return it. |
| 354 | \strong{Note:} only one \var{ch} can be pushed before \method{getch()} |
| 355 | is called. |
| 356 | \end{funcdesc} |
| 357 | |
| 358 | \begin{funcdesc}{use_env}{flag} |
| 359 | If used, this function should be called before \function{initscr} or |
| 360 | newterm are called. When \var{flag} is false, the values of |
| 361 | lines and columns specified in the terminfo database will be |
| 362 | used, even if environment variables LINES and COLUMNS (used by |
| 363 | default) are set, or if curses is running in a window (in which |
| 364 | case default behavior would be to use the window size if LINES |
| 365 | and COLUMNS are not set). |
| 366 | \end{funcdesc} |
Fred Drake | a4070ce | 1999-06-21 21:13:09 +0000 | [diff] [blame] | 367 | |
| 368 | \subsection{Window Objects \label{curses-window-objects}} |
| 369 | |
| 370 | Window objects, as returned by \function{initscr()} and |
| 371 | \function{newwin()} above, have the |
| 372 | following methods: |
| 373 | |
Fred Drake | a4070ce | 1999-06-21 21:13:09 +0000 | [diff] [blame] | 374 | \begin{methoddesc}{addch}{\optional{y, x,} ch\optional{, attr}} |
| 375 | \strong{Note:} A \emph{character} means a C character (i.e., an |
| 376 | \ASCII{} code), rather then a Python character (a string of length 1). |
| 377 | (This note is true whenever the documentation mentions a character.) |
| 378 | |
| 379 | Paint character \var{ch} at \code{(\var{y}, \var{x})} with attributes |
| 380 | \var{attr}, overwriting any character previously painter at that |
| 381 | location. By default, the character position and attributes are the |
| 382 | current settings for the window object. |
| 383 | \end{methoddesc} |
| 384 | |
Andrew M. Kuchling | f1dc5fa | 2000-05-23 16:46:04 +0000 | [diff] [blame] | 385 | \begin{methoddesc}{addnstr}{\optional{y, x,} str, n\optional{, attr}} |
| 386 | Paint at most \var{n} characters of the |
| 387 | string \var{str} at \code{(\var{y}, \var{x})} with attributes |
Fred Drake | 0bccd73 | 1999-06-23 17:28:01 +0000 | [diff] [blame] | 388 | \var{attr}, overwriting anything previously on the display. |
Fred Drake | a4070ce | 1999-06-21 21:13:09 +0000 | [diff] [blame] | 389 | \end{methoddesc} |
| 390 | |
Andrew M. Kuchling | f1dc5fa | 2000-05-23 16:46:04 +0000 | [diff] [blame] | 391 | \begin{methoddesc}{addstr}{\optional{y, x,} str\optional{, attr}} |
| 392 | Paint the string \var{str} at \code{(\var{y}, \var{x})} with attributes |
| 393 | \var{attr}, overwriting anything previously on the display. |
Fred Drake | a4070ce | 1999-06-21 21:13:09 +0000 | [diff] [blame] | 394 | \end{methoddesc} |
| 395 | |
| 396 | \begin{methoddesc}{attroff}{attr} |
Fred Drake | 0bccd73 | 1999-06-23 17:28:01 +0000 | [diff] [blame] | 397 | Turn off attribute \var{attr}. |
Fred Drake | a4070ce | 1999-06-21 21:13:09 +0000 | [diff] [blame] | 398 | \end{methoddesc} |
| 399 | |
Andrew M. Kuchling | f1dc5fa | 2000-05-23 16:46:04 +0000 | [diff] [blame] | 400 | \begin{methoddesc}{attron}{attr} |
| 401 | Turn on attribute \var{attr}. |
Fred Drake | a4070ce | 1999-06-21 21:13:09 +0000 | [diff] [blame] | 402 | \end{methoddesc} |
| 403 | |
Andrew M. Kuchling | f1dc5fa | 2000-05-23 16:46:04 +0000 | [diff] [blame] | 404 | \begin{methoddesc}{attrset}{attr} |
| 405 | Set the attributes to \var{attr}. |
Fred Drake | a4070ce | 1999-06-21 21:13:09 +0000 | [diff] [blame] | 406 | \end{methoddesc} |
| 407 | |
Andrew M. Kuchling | f1dc5fa | 2000-05-23 16:46:04 +0000 | [diff] [blame] | 408 | \begin{methoddesc}{bkgd}{ch\optional{, attr}} |
| 409 | Sets the background property of the window to the character \var{ch}, |
| 410 | with attributes \var{attr}. The change is then applied to every |
| 411 | character position in that window: |
| 412 | \begin{itemize} |
| 413 | \item The attribute of every character in the window is |
| 414 | changed to the new background attribute. |
| 415 | |
| 416 | \item Wherever the former background character appears, |
| 417 | it is changed to the new background character. |
| 418 | \end{itemize} |
| 419 | |
| 420 | \end{methoddesc} |
| 421 | |
| 422 | \begin{methoddesc}{bkgdset}{ch\optional{, attr}} |
| 423 | Sets the window's background. A window's background consists of a |
| 424 | character and any combination of attributes. The attribute part of |
| 425 | the background is combined (OR'ed) with all non-blank characters that |
| 426 | are written into the window. Both the character and attribute parts |
| 427 | of the background are combined with the blank characters. The |
| 428 | background becomes a property of the character and moves with the |
| 429 | character through any scrolling and insert/delete line/character |
| 430 | operations. |
Fred Drake | a4070ce | 1999-06-21 21:13:09 +0000 | [diff] [blame] | 431 | \end{methoddesc} |
| 432 | |
Fred Drake | 0bccd73 | 1999-06-23 17:28:01 +0000 | [diff] [blame] | 433 | \begin{methoddesc}{border}{\optional{ls\optional{, rs\optional{, ts\optional{, |
| 434 | bs\optional{, tl\optional{, tr\optional{, |
| 435 | bl\optional{, br}}}}}}}}} |
| 436 | Draw a border around the edges of the window. Each parameter specifies |
| 437 | the character to use for a specific part of the border; see the table |
| 438 | below for more details. The characters must be specified as integers; |
| 439 | using one-character strings will cause \exception{TypeError} to be |
| 440 | raised. |
| 441 | |
| 442 | \strong{Note:} A \code{0} value for any parameter will cause the |
| 443 | default character to be used for that parameter. Keyword parameters |
| 444 | can \emph{not} be used. The defaults are listed in this table: |
| 445 | |
| 446 | \begin{tableiii}{l|l|l}{var}{Parameter}{Description}{Default value} |
| 447 | \lineiii{ls}{Left side}{\constant{ACS_VLINE}} |
| 448 | \lineiii{rs}{Right side}{\constant{ACS_VLINE}} |
| 449 | \lineiii{ts}{Top}{\constant{ACS_HLINE}} |
| 450 | \lineiii{bs}{Bottom}{\constant{ACS_HLINE}} |
| 451 | \lineiii{tl}{Upper-left corner}{\constant{ACS_ULCORNER}} |
| 452 | \lineiii{tr}{Upper-right corner}{\constant{ACS_URCORNER}} |
| 453 | \lineiii{bl}{Bottom-left corner}{\constant{ACS_BLCORNER}} |
| 454 | \lineiii{br}{Bottom-right corner}{\constant{ACS_BRCORNER}} |
| 455 | \end{tableiii} |
Fred Drake | a4070ce | 1999-06-21 21:13:09 +0000 | [diff] [blame] | 456 | \end{methoddesc} |
| 457 | |
Fred Drake | 0bccd73 | 1999-06-23 17:28:01 +0000 | [diff] [blame] | 458 | \begin{methoddesc}{box}{\optional{vertch, horch}} |
| 459 | Similar to \method{border()}, but both \var{ls} and \var{rs} are |
| 460 | \var{vertch} and both \var{ts} and {bs} are \var{horch}. The default |
| 461 | corner characters are always used by this function. |
Fred Drake | a4070ce | 1999-06-21 21:13:09 +0000 | [diff] [blame] | 462 | \end{methoddesc} |
| 463 | |
Fred Drake | a4070ce | 1999-06-21 21:13:09 +0000 | [diff] [blame] | 464 | \begin{methoddesc}{clear}{} |
| 465 | Like \method{erase()}, but also causes the whole screen to be repainted |
| 466 | upon next call to \method{refresh()}. |
| 467 | \end{methoddesc} |
| 468 | |
Andrew M. Kuchling | f1dc5fa | 2000-05-23 16:46:04 +0000 | [diff] [blame] | 469 | \begin{methoddesc}{clearok}{yes} |
| 470 | If \var{yes} is 1, the next call to \method{refresh()} |
| 471 | will clear the screen completely. |
| 472 | \end{methoddesc} |
| 473 | |
Fred Drake | a4070ce | 1999-06-21 21:13:09 +0000 | [diff] [blame] | 474 | \begin{methoddesc}{clrtobot}{} |
| 475 | Erase from cursor to the end of the screen: all lines below the cursor |
| 476 | are deleted, and then the equivalent of \method{clrtoeol()} is performed. |
| 477 | \end{methoddesc} |
| 478 | |
| 479 | \begin{methoddesc}{clrtoeol}{} |
| 480 | Erase from cursor to the end of the line. |
| 481 | \end{methoddesc} |
| 482 | |
Andrew M. Kuchling | f1dc5fa | 2000-05-23 16:46:04 +0000 | [diff] [blame] | 483 | \begin{methoddesc}{cursyncup}{} |
| 484 | Updates the current cursor position of all the ancestors of the window |
| 485 | to reflect the current cursor position of the window. |
Fred Drake | a4070ce | 1999-06-21 21:13:09 +0000 | [diff] [blame] | 486 | \end{methoddesc} |
| 487 | |
Andrew M. Kuchling | f1dc5fa | 2000-05-23 16:46:04 +0000 | [diff] [blame] | 488 | \begin{methoddesc}{delch}{\optional{x, y}} |
| 489 | Delete any character at \code{(\var{y}, \var{x})}. |
Fred Drake | a4070ce | 1999-06-21 21:13:09 +0000 | [diff] [blame] | 490 | \end{methoddesc} |
| 491 | |
Andrew M. Kuchling | f1dc5fa | 2000-05-23 16:46:04 +0000 | [diff] [blame] | 492 | \begin{methoddesc}{deleteln}{} |
| 493 | Delete the line under the cursor. All following lines are moved up |
| 494 | by 1 line. |
| 495 | \end{methoddesc} |
| 496 | |
| 497 | \begin{methoddesc}{derwin}{\optional{nlines, ncols,} begin_y, begin_y} |
| 498 | An abbreviation for ``derive window'', \method{derwin()} is the same |
| 499 | as calling \method{subwin()}, except that \var{begin_y} and |
| 500 | \var{begin_x} are relative to the origin of the window, rather than |
| 501 | relative to the entire screen. Returns a window object for the |
| 502 | derived window. |
| 503 | \end{methoddesc} |
| 504 | |
| 505 | \begin{methoddesc}{echochar}{ch\optional{, attr}} |
| 506 | Add character \var{ch} with attribute \var{attr}, and immediately |
| 507 | call \method{refresh}. |
| 508 | \end{methoddesc} |
| 509 | |
| 510 | \begin{methoddesc}{erase}{} |
| 511 | Clear the window. |
| 512 | \end{methoddesc} |
| 513 | |
| 514 | \begin{methoddesc}{getbegyx}{} |
| 515 | Return a tuple \code{(\var{y}, \var{x})} of co-ordinates of upper-left |
| 516 | corner. |
Fred Drake | a4070ce | 1999-06-21 21:13:09 +0000 | [diff] [blame] | 517 | \end{methoddesc} |
| 518 | |
| 519 | \begin{methoddesc}{getch}{\optional{x, y}} |
| 520 | Get a character. Note that the integer returned does \emph{not} have to |
| 521 | be in \ASCII{} range: function keys, keypad keys and so on return numbers |
| 522 | higher then 256. In no-delay mode, an exception is raised if there is |
| 523 | no input. |
| 524 | \end{methoddesc} |
| 525 | |
Andrew M. Kuchling | f1dc5fa | 2000-05-23 16:46:04 +0000 | [diff] [blame] | 526 | \begin{methoddesc}{getkey}{\optional{x, y}} |
| 527 | Get a character, returning a string instead of an integer, as |
| 528 | \method{getch()} does. Function keys, keypad keys and so on return a |
| 529 | multibyte string containing the key name. In no-delay mode, an |
| 530 | exception is raised if there is no input. |
| 531 | \end{methoddesc} |
| 532 | |
| 533 | \begin{methoddesc}{getmaxyx}{} |
| 534 | Return a tuple \code{(\var{y}, \var{x})} of the height and width of |
| 535 | the window. |
| 536 | \end{methoddesc} |
| 537 | |
| 538 | \begin{methoddesc}{getparyx}{} |
| 539 | Returns the beginning coordinates of this window relative to its |
| 540 | parent window into two integer variables y and x. Returns |
| 541 | \code{-1,-1} if this window has no parent. |
| 542 | \end{methoddesc} |
| 543 | |
Fred Drake | a4070ce | 1999-06-21 21:13:09 +0000 | [diff] [blame] | 544 | \begin{methoddesc}{getstr}{\optional{x, y}} |
| 545 | Read a string from the user, with primitive line editing capacity. |
| 546 | \end{methoddesc} |
| 547 | |
Andrew M. Kuchling | f1dc5fa | 2000-05-23 16:46:04 +0000 | [diff] [blame] | 548 | \begin{methoddesc}{getyx}{} |
| 549 | Return a tuple \code{(\var{y}, \var{x})} of current cursor position. |
| 550 | \end{methoddesc} |
| 551 | |
| 552 | \begin{methoddesc}{hline}{\optional{y, x,} ch, n} |
| 553 | Display a horizontal line starting at \code{(\var{y}, \var{x})} with |
| 554 | length \var{n} consisting of the character \var{ch}. |
| 555 | \end{methoddesc} |
| 556 | |
| 557 | \begin{methoddesc}{idcok}{flag} |
| 558 | If \var{flag} is false, curses no longer considers using the hardware |
| 559 | insert/delete character feature of the terminal; if \var{flag} is |
| 560 | true, use of character insertion and deletion is enabled. When curses |
| 561 | is first initialized, use of character insert/delete is enabled by |
| 562 | default. |
| 563 | \end{methoddesc} |
| 564 | |
| 565 | \begin{methoddesc}{idlok}{yes} |
| 566 | If called with \var{yes} equal to 1, \module{curses} will try and use |
| 567 | hardware line editing facilities. Otherwise, line insertion/deletion |
| 568 | are disabled. |
| 569 | \end{methoddesc} |
| 570 | |
| 571 | \begin{methoddesc}{immedok}{flag} |
| 572 | If \var{flag} is true, any change in the window image |
| 573 | automatically causes the window to be refreshed; you no longer |
| 574 | have to call \method{refresh()} yourself. However, it may |
| 575 | degrade performance considerably, due to repeated calls to |
| 576 | wrefresh. This option is disabled by default. |
| 577 | \end{methoddesc} |
| 578 | |
Fred Drake | a4070ce | 1999-06-21 21:13:09 +0000 | [diff] [blame] | 579 | \begin{methoddesc}{inch}{\optional{x, y}} |
| 580 | Return the character at the given position in the window. The bottom |
| 581 | 8 bits are the character proper, and upper bits are the attributes. |
| 582 | \end{methoddesc} |
| 583 | |
Andrew M. Kuchling | f1dc5fa | 2000-05-23 16:46:04 +0000 | [diff] [blame] | 584 | \begin{methoddesc}{insch}{\optional{y, x,} ch\optional{, attr}} |
| 585 | Paint character \var{ch} at \code{(\var{y}, \var{x})} with attributes |
| 586 | \var{attr}, moving the line from position \var{x} right by one |
| 587 | character. |
Fred Drake | a4070ce | 1999-06-21 21:13:09 +0000 | [diff] [blame] | 588 | \end{methoddesc} |
| 589 | |
Andrew M. Kuchling | f1dc5fa | 2000-05-23 16:46:04 +0000 | [diff] [blame] | 590 | \begin{methoddesc}{insdelln}{nlines} |
| 591 | Inserts \var{nlines} lines into the specified window above the current |
| 592 | line. The \var{nlines} bottom lines are lost. For negative |
| 593 | \var{nlines}, delete \var{nlines} lines starting with the one under |
| 594 | the cursor, and move the remaining lines up. The bottom \var{nlines} |
| 595 | lines are cleared. The current cursor position remains the same. |
| 596 | \end{methoddesc} |
| 597 | |
| 598 | \begin{methoddesc}{insertln}{} |
| 599 | Insert a blank line under the cursor. All following lines are moved |
| 600 | down by 1 line. |
| 601 | \end{methoddesc} |
| 602 | |
| 603 | \begin{methoddesc}{insnstr}{\optional{y, x, } str, n \optional{, attr}} |
| 604 | Insert a character string (as many characters as will fit on the line) |
| 605 | before the character under the cursor, up to \var{n} characters. |
| 606 | If \var{n} is zero or negative, |
| 607 | the entire string is inserted. |
| 608 | All characters to the right of |
| 609 | the cursor are shifted right, with the the rightmost characters on the |
| 610 | line being lost. The cursor position does not change (after moving to |
| 611 | \var{y}, \var{x}, if specified). |
| 612 | \end{methoddesc} |
| 613 | |
| 614 | \begin{methoddesc}{insstr}{\optional{y, x, } str \optional{, attr}} |
| 615 | Insert a character string (as many characters as will fit on the line) |
| 616 | before the character under the cursor. All characters to the right of |
| 617 | the cursor are shifted right, with the the rightmost characters on the |
| 618 | line being lost. The cursor position does not change (after moving to |
| 619 | \var{y}, \var{x}, if specified). |
| 620 | \end{methoddesc} |
| 621 | |
| 622 | \begin{methoddesc}{instr}{\optional{y, x} \optional{, n}} |
| 623 | Returns a string of characters, extracted from the window starting at |
| 624 | the current cursor position, or at \var{y}, \var{x} if specified. |
| 625 | Attributes are stripped from the characters. If \var{n} is specified, |
| 626 | \method{instr()} returns return a string at most \var{n} characters |
| 627 | long (exclusive of the trailing NUL). |
| 628 | \end{methoddesc} |
| 629 | |
| 630 | \begin{methoddesc}{is_linetouched}{\var{line}} |
| 631 | Returns true if the specified line was modified since the last call to |
| 632 | \method{refresh()}; otherwise returns false. Raises a |
| 633 | \exception{curses.error} exception if \var{line} is not valid |
| 634 | for the given window. |
| 635 | \end{methoddesc} |
| 636 | |
| 637 | \begin{methoddesc}{is_wintouched}{} |
| 638 | Returns true if the specified window was modified since the last call to |
| 639 | \method{refresh()}; otherwise returns false. |
| 640 | \end{methoddesc} |
| 641 | |
| 642 | \begin{methoddesc}{keypad}{yes} |
| 643 | If \var{yes} is 1, escape sequences generated by some keys (keypad, |
| 644 | function keys) will be interpreted by \module{curses}. |
| 645 | If \var{yes} is 0, escape sequences will be left as is in the input |
| 646 | stream. |
Fred Drake | a4070ce | 1999-06-21 21:13:09 +0000 | [diff] [blame] | 647 | \end{methoddesc} |
| 648 | |
| 649 | \begin{methoddesc}{leaveok}{yes} |
| 650 | If \var{yes} is 1, |
| 651 | cursor is left where it is, instead of being at ``cursor position.'' |
| 652 | This reduces cursor movement where possible. If possible it will be made |
| 653 | invisible. |
| 654 | |
| 655 | If \var{yes} is 0, cursor will always be at |
| 656 | ``cursor position'' after an update. |
| 657 | \end{methoddesc} |
| 658 | |
Andrew M. Kuchling | f1dc5fa | 2000-05-23 16:46:04 +0000 | [diff] [blame] | 659 | \begin{methoddesc}{move}{new_y, new_x} |
| 660 | Move cursor to \code{(\var{new_y}, \var{new_x})}. |
Fred Drake | a4070ce | 1999-06-21 21:13:09 +0000 | [diff] [blame] | 661 | \end{methoddesc} |
| 662 | |
Andrew M. Kuchling | f1dc5fa | 2000-05-23 16:46:04 +0000 | [diff] [blame] | 663 | \begin{methoddesc}{mvderwin}{y, x} |
| 664 | Moves the window inside its parent window. The screen-relative |
| 665 | parameters of the window are not changed. This routine is used to |
| 666 | display different parts of the parent window at the same physical |
| 667 | position on the screen. |
| 668 | \end{methoddesc} |
Fred Drake | a4070ce | 1999-06-21 21:13:09 +0000 | [diff] [blame] | 669 | |
Andrew M. Kuchling | f1dc5fa | 2000-05-23 16:46:04 +0000 | [diff] [blame] | 670 | \begin{methoddesc}{mvwin}{new_y, new_x} |
| 671 | Move the window so its upper-left corner is at \code{(\var{new_y}, \var{new_x})}. |
Fred Drake | a4070ce | 1999-06-21 21:13:09 +0000 | [diff] [blame] | 672 | \end{methoddesc} |
| 673 | |
| 674 | \begin{methoddesc}{nodelay}{yes} |
| 675 | If \var{yes} is 1, \method{getch()} will be non-blocking. |
| 676 | \end{methoddesc} |
| 677 | |
| 678 | \begin{methoddesc}{notimeout}{yes} |
| 679 | If \var{yes} is 1, escape sequences will not be timed out. |
| 680 | |
| 681 | If \var{yes} is 0, after a few milliseconds, an escape sequence will |
| 682 | not be interpreted, and will be left in the input stream as is. |
| 683 | \end{methoddesc} |
Andrew M. Kuchling | f1dc5fa | 2000-05-23 16:46:04 +0000 | [diff] [blame] | 684 | |
| 685 | \begin{methoddesc}{noutrefresh}{} |
| 686 | Mark for refresh but wait. |
| 687 | \end{methoddesc} |
| 688 | |
| 689 | \begin{methoddesc}{putwin}{file} |
| 690 | Writes all data associated with the window into the provided file |
| 691 | object. This information can be later retrieved using the |
| 692 | \function{getwin()} function. |
| 693 | |
| 694 | \end{methoddesc} |
| 695 | |
| 696 | \begin{methoddesc}{redrawln}{beg, num} |
| 697 | Indicates that the \var{num} screen lines, starting at line \var{beg}, |
| 698 | are corrupted and should be completely redrawn on the next |
| 699 | \method{refresh()} call. |
| 700 | \end{methoddesc} |
| 701 | |
| 702 | \begin{methoddesc}{redrawwin}{} |
| 703 | Touches the entire window, causing it to be completely redrawn on the |
| 704 | next \method{refresh()} call. |
| 705 | \end{methoddesc} |
| 706 | |
| 707 | \begin{methoddesc}{refresh}{ \optional{pminrow, pmincol, sminrow, smincol, smaxrow, smaxcol} } |
| 708 | Update the display immediately (sync actual screen with previous |
| 709 | drawing/deleting methods). |
| 710 | |
| 711 | The 6 optional arguments can only be specified when the window is a |
| 712 | pad created with \function{newpad()}. The additional parameters are |
| 713 | needed to indicate what part of the pad and screen are involved. |
| 714 | \var{pminrow} and \var{pmincol} specify the upper left-hand corner of the |
| 715 | rectangle to be displayed in the pad. \var{sminrow}, \var{smincol}, |
| 716 | \var{smaxrow}, and \var{smaxcol} specify the edges of the rectangle to be displayed on the screen. The lower right-hand corner of the |
| 717 | rectangle to be displayed in the pad is calculated from the screen |
| 718 | coordinates, since the rectangles must be the same size. Both |
| 719 | rectangles must be entirely contained within their respective |
| 720 | structures. Negative values of \var{pminrow}, \var{pmincol}, |
| 721 | \var{sminrow}, or \var{smincol} are treated as if they were zero. |
| 722 | \end{methoddesc} |
| 723 | |
| 724 | \begin{methoddesc}{scroll}{\optional{lines\code{ = 1}}} |
| 725 | Scroll the screen upward by \var{lines} lines. |
| 726 | \end{methoddesc} |
| 727 | |
| 728 | \begin{methoddesc}{scrollok}{flag} |
| 729 | Controls what happens when the cursor of a window is moved off the |
| 730 | edge of the window or scrolling region, either as a result of a |
| 731 | newline action on the bottom line, or typing the last character |
| 732 | of the last line. If \var{flag} is false, the cursor is left |
| 733 | on the bottom line. If \var{flag} is true, the window is |
| 734 | scrolled up one line. Note that in order to get the physical |
| 735 | scrolling effect on the terminal, it is also necessary to call |
| 736 | \method{idlok()}. |
| 737 | \end{methoddesc} |
| 738 | |
| 739 | \begin{methoddesc}{setscrreg}{top, bottom} |
| 740 | Set the scrolling region from line \var{top} to line \var{bottom}. All |
| 741 | scrolling actions will take place in this region. |
| 742 | \end{methoddesc} |
| 743 | |
| 744 | \begin{methoddesc}{standend}{} |
| 745 | Turn off all attributes. |
| 746 | \end{methoddesc} |
| 747 | |
| 748 | \begin{methoddesc}{standout}{} |
| 749 | Turn on attribute \var{A_STANDOUT}. |
| 750 | \end{methoddesc} |
| 751 | |
| 752 | \begin{methoddesc}{subpad}{\optional{nlines, ncols,} begin_y, begin_y} |
| 753 | Return a sub-window, whose upper-left corner is at |
| 754 | \code{(\var{begin_y}, \var{begin_x})}, and whose width/height is |
| 755 | \var{ncols}/\var{nlines}. |
| 756 | \end{methoddesc} |
| 757 | |
| 758 | \begin{methoddesc}{subwin}{\optional{nlines, ncols,} begin_y, begin_y} |
| 759 | Return a sub-window, whose upper-left corner is at |
| 760 | \code{(\var{begin_y}, \var{begin_x})}, and whose width/height is |
| 761 | \var{ncols}/\var{nlines}. |
| 762 | |
| 763 | By default, the sub-window will extend from the |
| 764 | specified position to the lower right corner of the window. |
| 765 | \end{methoddesc} |
| 766 | |
| 767 | \begin{methoddesc}{syncdown}{} |
| 768 | Touches each location in the window that has been touched in any of |
| 769 | its ancestor windows. This routine is called by \method{refresh()}, |
| 770 | so it should almost never be necessary to call it manually. |
| 771 | \end{methoddesc} |
| 772 | |
| 773 | \begin{methoddesc}{syncok}{flag} |
| 774 | If called with \var{flag} set to true, then \method{syncup()} is |
| 775 | called automatically whenever there is a change in the window. |
| 776 | \end{methoddesc} |
| 777 | |
| 778 | \begin{methoddesc}{syncup}{} |
| 779 | Touches all locations in ancestors of the window that have been changed in |
| 780 | the window. |
| 781 | \end{methoddesc} |
| 782 | |
| 783 | \begin{methoddesc}{touchline}{start, count} |
| 784 | Pretend \var{count} lines have been changed, starting with line |
| 785 | \var{start}. |
| 786 | \end{methoddesc} |
| 787 | |
| 788 | \begin{methoddesc}{touchwin}{} |
| 789 | Pretend the whole window has been changed, for purposes of drawing |
| 790 | optimizations. |
| 791 | \end{methoddesc} |
| 792 | |
| 793 | \begin{methoddesc}{untouchwin}{} |
| 794 | Marks all lines in the window as unchanged since the last call to |
| 795 | \method{refresh()}. |
| 796 | \end{methoddesc} |
| 797 | |
| 798 | \begin{methoddesc}{vline}{\optional{y, x,} ch, n} |
| 799 | Display a vertical line starting at \code{(\var{y}, \var{x})} with |
| 800 | length \var{n} consisting of the character \var{ch}. |
| 801 | \end{methoddesc} |
| 802 | |
| 803 | \subsection{Constants} |
| 804 | |
| 805 | The \module{curses} module defines the following data members: |
| 806 | |
| 807 | \begin{datadesc}{version} |
| 808 | A string representing the current version of the module. |
| 809 | Also available as \constant{__version__}. |
| 810 | \end{datadesc} |
| 811 | |
| 812 | |
| 813 | \begin{tableii}{c|l}{code}{Attribute}{Meaning} |
| 814 | \lineii{A_ALTCHARSET}{Alternate character set mode.} |
| 815 | \lineii{A_BLINK}{Blink mode.} |
| 816 | \lineii{A_BOLD}{Bold mode.} |
| 817 | \lineii{A_DIM}{Dim mode.} |
| 818 | \lineii{A_NORMAL}{Normal attribute.} |
| 819 | \lineii{A_STANDOUT}{Standout mode.} |
| 820 | \lineii{A_UNDERLINE}{Underline mode.} |
| 821 | \end{tableii} |
| 822 | |
| 823 | Keys are referred to by integer constants with names starting with |
| 824 | \code{KEY_}. The exact names available are system dependent. |
| 825 | |
| 826 | % XXX this table is far too large! |
| 827 | % XXX should this table be alphabetized? |
| 828 | |
| 829 | \begin{tableii}{c|l}{code}{Key constant}{Key} |
| 830 | \lineii{KEY_MIN}{Minimum key value} |
| 831 | \lineii{KEY_BREAK}{ Break key (unreliable) } |
| 832 | \lineii{KEY_DOWN}{ Down-arrow } |
| 833 | \lineii{KEY_UP}{ Up-arrow } |
| 834 | \lineii{KEY_LEFT}{ Left-arrow } |
| 835 | \lineii{KEY_RIGHT}{ Right-arrow } |
| 836 | \lineii{KEY_HOME}{ Home key (upward+left arrow) } |
| 837 | \lineii{KEY_BACKSPACE}{ Backspace (unreliable) } |
| 838 | \lineii{KEY_F0}{ Function keys. Up to 64 function keys are supported. } |
| 839 | \lineii{KEY_F\var{n}}{ Value of function key \var{n} } |
| 840 | \lineii{KEY_DL}{ Delete line } |
| 841 | \lineii{KEY_IL}{ Insert line } |
| 842 | \lineii{KEY_DC}{ Delete character } |
| 843 | \lineii{KEY_IC}{ Insert char or enter insert mode } |
| 844 | \lineii{KEY_EIC}{ Exit insert char mode } |
| 845 | \lineii{KEY_CLEAR}{ Clear screen } |
| 846 | \lineii{KEY_EOS}{ Clear to end of screen } |
| 847 | \lineii{KEY_EOL}{ Clear to end of line } |
| 848 | \lineii{KEY_SF}{ Scroll 1 line forward } |
| 849 | \lineii{KEY_SR}{ Scroll 1 line backward (reverse) } |
| 850 | \lineii{KEY_NPAGE}{ Next page } |
| 851 | \lineii{KEY_PPAGE}{ Previous page } |
| 852 | \lineii{KEY_STAB}{ Set tab } |
| 853 | \lineii{KEY_CTAB}{ Clear tab } |
| 854 | \lineii{KEY_CATAB}{ Clear all tabs } |
| 855 | \lineii{KEY_ENTER}{ Enter or send (unreliable) } |
| 856 | \lineii{KEY_SRESET}{ Soft (partial) reset (unreliable) } |
| 857 | \lineii{KEY_RESET}{ Reset or hard reset (unreliable) } |
| 858 | \lineii{KEY_PRINT}{ Print } |
| 859 | \lineii{KEY_LL}{ Home down or bottom (lower left) } |
| 860 | \lineii{KEY_A1}{ Upper left of keypad } |
| 861 | \lineii{KEY_A3}{ Upper right of keypad } |
| 862 | \lineii{KEY_B2}{ Center of keypad } |
| 863 | \lineii{KEY_C1}{ Lower left of keypad } |
| 864 | \lineii{KEY_C3}{ Lower right of keypad } |
| 865 | \lineii{KEY_BTAB}{ Back tab } |
| 866 | \lineii{KEY_BEG}{ Beg (beginning) } |
| 867 | \lineii{KEY_CANCEL}{ Cancel } |
| 868 | \lineii{KEY_CLOSE}{ Close } |
| 869 | \lineii{KEY_COMMAND}{ Cmd (command) } |
| 870 | \lineii{KEY_COPY}{ Copy } |
| 871 | \lineii{KEY_CREATE}{ Create } |
| 872 | \lineii{KEY_END}{ End } |
| 873 | \lineii{KEY_EXIT}{ Exit } |
| 874 | \lineii{KEY_FIND}{ Find } |
| 875 | \lineii{KEY_HELP}{ Help } |
| 876 | \lineii{KEY_MARK}{ Mark } |
| 877 | \lineii{KEY_MESSAGE}{ Message } |
| 878 | \lineii{KEY_MOVE}{ Move } |
| 879 | \lineii{KEY_NEXT}{ Next } |
| 880 | \lineii{KEY_OPEN}{ Open } |
| 881 | \lineii{KEY_OPTIONS}{ Options } |
| 882 | \lineii{KEY_PREVIOUS}{ Prev (previous) } |
| 883 | \lineii{KEY_REDO}{ Redo } |
| 884 | \lineii{KEY_REFERENCE}{ Ref (reference) } |
| 885 | \lineii{KEY_REFRESH}{ Refresh } |
| 886 | \lineii{KEY_REPLACE}{ Replace } |
| 887 | \lineii{KEY_RESTART}{ Restart } |
| 888 | \lineii{KEY_RESUME}{ Resume } |
| 889 | \lineii{KEY_SAVE}{ Save } |
| 890 | \lineii{KEY_SBEG}{ Shifted Beg (beginning) } |
| 891 | \lineii{KEY_SCANCEL}{ Shifted Cancel } |
| 892 | \lineii{KEY_SCOMMAND}{ Shifted Command } |
| 893 | \lineii{KEY_SCOPY}{ Shifted Copy } |
| 894 | \lineii{KEY_SCREATE}{ Shifted Create } |
| 895 | \lineii{KEY_SDC}{ Shifted Delete char } |
| 896 | \lineii{KEY_SDL}{ Shifted Delete line } |
| 897 | \lineii{KEY_SELECT}{ Select } |
| 898 | \lineii{KEY_SEND}{ Shifted End } |
| 899 | \lineii{KEY_SEOL}{ Shifted Clear line } |
| 900 | \lineii{KEY_SEXIT}{ Shifted Dxit } |
| 901 | \lineii{KEY_SFIND}{ Shifted Find } |
| 902 | \lineii{KEY_SHELP}{ Shifted Help } |
| 903 | \lineii{KEY_SHOME}{ Shifted Home } |
| 904 | \lineii{KEY_SIC}{ Shifted Input } |
| 905 | \lineii{KEY_SLEFT}{ Shifted Left arrow } |
| 906 | \lineii{KEY_SMESSAGE}{ Shifted Message } |
| 907 | \lineii{KEY_SMOVE}{ Shifted Move } |
| 908 | \lineii{KEY_SNEXT}{ Shifted Next } |
| 909 | \lineii{KEY_SOPTIONS}{ Shifted Options } |
| 910 | \lineii{KEY_SPREVIOUS}{ Shifted Prev } |
| 911 | \lineii{KEY_SPRINT}{ Shifted Print } |
| 912 | \lineii{KEY_SREDO}{ Shifted Redo } |
| 913 | \lineii{KEY_SREPLACE}{ Shifted Replace } |
| 914 | \lineii{KEY_SRIGHT}{ Shifted Right arrow } |
| 915 | \lineii{KEY_SRSUME}{ Shifted Resume } |
| 916 | \lineii{KEY_SSAVE}{ Shifted Save } |
| 917 | \lineii{KEY_SSUSPEND}{ Shifted Suspend } |
| 918 | \lineii{KEY_SUNDO}{ Shifted Undo } |
| 919 | \lineii{KEY_SUSPEND}{ Suspend } |
| 920 | \lineii{KEY_UNDO}{ Undo } |
| 921 | \lineii{KEY_MOUSE}{ Mouse event has occurred } |
| 922 | \lineii{KEY_RESIZE}{ Terminal resize event } |
| 923 | \lineii{KEY_MAX}{Maximum key value} |
| 924 | \end{tableii} |
| 925 | |
| 926 | The following table lists characters from the alternate character set. |
| 927 | \strong{Note:} These are available only after \function{initscr()} has |
| 928 | been called. |
| 929 | |
| 930 | \begin{tableii}{c|l}{code}{ACS code}{Meaning} |
| 931 | \lineii{ACS_BBSS}{} |
| 932 | \lineii{ACS_BLOCK}{} |
| 933 | \lineii{ACS_BOARD}{} |
| 934 | \lineii{ACS_BSBS}{} |
| 935 | \lineii{ACS_BSSB}{} |
| 936 | \lineii{ACS_BSSS}{} |
| 937 | \lineii{ACS_BTEE}{} |
| 938 | \lineii{ACS_BULLET}{} |
| 939 | \lineii{ACS_CKBOARD}{} |
| 940 | \lineii{ACS_DARROW}{} |
| 941 | \lineii{ACS_DEGREE}{} |
| 942 | \lineii{ACS_DIAMOND}{} |
| 943 | \lineii{ACS_GEQUAL}{ (Not available with SGI curses)} |
| 944 | \lineii{ACS_HLINE}{} |
| 945 | \lineii{ACS_LANTERN}{} |
| 946 | \lineii{ACS_LARROW}{} |
| 947 | \lineii{ACS_LEQUAL}{ (Not available with SGI curses)} |
| 948 | \lineii{ACS_LLCORNER}{} |
| 949 | \lineii{ACS_LRCORNER}{} |
| 950 | \lineii{ACS_LTEE}{} |
| 951 | \lineii{ACS_NEQUAL}{ (Not available with SGI curses)} |
| 952 | \lineii{ACS_PI}{ (Not available with SGI curses)} |
| 953 | \lineii{ACS_PLMINUS}{} |
| 954 | \lineii{ACS_PLUS}{} |
| 955 | \lineii{ACS_RARROW}{} |
| 956 | \lineii{ACS_RTEE}{} |
| 957 | \lineii{ACS_S1}{} |
| 958 | \lineii{ACS_S3}{ (Not available with SGI curses)} |
| 959 | \lineii{ACS_S9}{} |
| 960 | \lineii{ACS_SBBS}{} |
| 961 | \lineii{ACS_SBSB}{} |
| 962 | \lineii{ACS_SBSS}{} |
| 963 | \lineii{ACS_SSBB}{} |
| 964 | \lineii{ACS_SSBS}{} |
| 965 | \lineii{ACS_SSSB}{} |
| 966 | \lineii{ACS_SSSS}{} |
| 967 | \lineii{ACS_STERLING}{ (Not available with SGI curses)} |
| 968 | \lineii{ACS_TTEE}{} |
| 969 | \lineii{ACS_UARROW}{} |
| 970 | \lineii{ACS_ULCORNER}{} |
| 971 | \lineii{ACS_URCORNER}{} |
| 972 | \lineii{ACS_VLINE}{} |
| 973 | \end{tableii} |
| 974 | |
| 975 | The following table lists the predefined colors: |
| 976 | |
| 977 | \begin{tableii}{c|l}{code}{Constant}{Color} |
| 978 | \lineii{COLOR_BLACK}{Black} |
| 979 | \lineii{COLOR_BLUE}{Blue} |
| 980 | \lineii{COLOR_CYAN}{Cyan (light greenish blue)} |
| 981 | \lineii{COLOR_GREEN}{Green} |
| 982 | \lineii{COLOR_MAGENTA}{Magenta (purplish red)} |
| 983 | \lineii{COLOR_RED}{Red} |
| 984 | \lineii{COLOR_WHITE}{White} |
| 985 | \lineii{COLOR_YELLOW}{Yellow} |
| 986 | \end{tableii} |
| 987 | |