| 1 | <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> |
| 2 | <html> |
| 3 | <head> |
| 4 | <link rel="STYLESHEET" href="lib.css" type='text/css' /> |
| 5 | <link rel="SHORTCUT ICON" href="../icons/pyfav.png" type="image/png" /> |
| 6 | <link rel='start' href='../index.html' title='Python Documentation Index' /> |
| 7 | <link rel="first" href="lib.html" title='Python Library Reference' /> |
| 8 | <link rel='contents' href='contents.html' title="Contents" /> |
| 9 | <link rel='index' href='genindex.html' title='Index' /> |
| 10 | <link rel='last' href='about.html' title='About this document...' /> |
| 11 | <link rel='help' href='about.html' title='About this document...' /> |
| 12 | <link rel="next" href="curses-window-objects.html" /> |
| 13 | <link rel="prev" href="module-curses.html" /> |
| 14 | <link rel="parent" href="module-curses.html" /> |
| 15 | <link rel="next" href="curses-window-objects.html" /> |
| 16 | <meta name='aesop' content='information' /> |
| 17 | <title>6.15.1 Functions </title> |
| 18 | </head> |
| 19 | <body> |
| 20 | <DIV CLASS="navigation"> |
| 21 | <div id='top-navigation-panel' xml:id='top-navigation-panel'> |
| 22 | <table align="center" width="100%" cellpadding="0" cellspacing="2"> |
| 23 | <tr> |
| 24 | <td class='online-navigation'><a rel="prev" title="6.15 curses " |
| 25 | href="module-curses.html"><img src='../icons/previous.png' |
| 26 | border='0' height='32' alt='Previous Page' width='32' /></A></td> |
| 27 | <td class='online-navigation'><a rel="parent" title="6.15 curses " |
| 28 | href="module-curses.html"><img src='../icons/up.png' |
| 29 | border='0' height='32' alt='Up One Level' width='32' /></A></td> |
| 30 | <td class='online-navigation'><a rel="next" title="6.15.2 Window Objects" |
| 31 | href="curses-window-objects.html"><img src='../icons/next.png' |
| 32 | border='0' height='32' alt='Next Page' width='32' /></A></td> |
| 33 | <td align="center" width="100%">Python Library Reference</td> |
| 34 | <td class='online-navigation'><a rel="contents" title="Table of Contents" |
| 35 | href="contents.html"><img src='../icons/contents.png' |
| 36 | border='0' height='32' alt='Contents' width='32' /></A></td> |
| 37 | <td class='online-navigation'><a href="modindex.html" title="Module Index"><img src='../icons/modules.png' |
| 38 | border='0' height='32' alt='Module Index' width='32' /></a></td> |
| 39 | <td class='online-navigation'><a rel="index" title="Index" |
| 40 | href="genindex.html"><img src='../icons/index.png' |
| 41 | border='0' height='32' alt='Index' width='32' /></A></td> |
| 42 | </tr></table> |
| 43 | <div class='online-navigation'> |
| 44 | <b class="navlabel">Previous:</b> |
| 45 | <a class="sectref" rel="prev" href="module-curses.html">6.15 curses </A> |
| 46 | <b class="navlabel">Up:</b> |
| 47 | <a class="sectref" rel="parent" href="module-curses.html">6.15 curses </A> |
| 48 | <b class="navlabel">Next:</b> |
| 49 | <a class="sectref" rel="next" href="curses-window-objects.html">6.15.2 Window Objects</A> |
| 50 | </div> |
| 51 | <hr /></div> |
| 52 | </DIV> |
| 53 | <!--End of Navigation Panel--> |
| 54 | |
| 55 | <H2><A NAME="SECTION0081510000000000000000"></A><A NAME="curses-functions"></A> |
| 56 | <BR> |
| 57 | 6.15.1 Functions |
| 58 | </H2> |
| 59 | |
| 60 | <P> |
| 61 | The module <tt class="module">curses</tt> defines the following exception: |
| 62 | |
| 63 | <P> |
| 64 | <dl><dt><b><span class="typelabel">exception</span> <tt id='l2h-2001' xml:id='l2h-2001' class="exception">error</tt></b></dt> |
| 65 | <dd> |
| 66 | Exception raised when a curses library function returns an error. |
| 67 | </dd></dl> |
| 68 | |
| 69 | <P> |
| 70 | <span class="note"><b class="label">Note:</b> |
| 71 | Whenever <var>x</var> or <var>y</var> arguments to a function |
| 72 | or a method are optional, they default to the current cursor location. |
| 73 | Whenever <var>attr</var> is optional, it defaults to <tt class="constant">A_NORMAL</tt>.</span> |
| 74 | |
| 75 | <P> |
| 76 | The module <tt class="module">curses</tt> defines the following functions: |
| 77 | |
| 78 | <P> |
| 79 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> |
| 80 | <td><nobr><b><tt id='l2h-2002' xml:id='l2h-2002' class="function">baudrate</tt></b>(</nobr></td> |
| 81 | <td><var></var>)</td></tr></table></dt> |
| 82 | <dd> |
| 83 | Returns the output speed of the terminal in bits per second. On |
| 84 | software terminal emulators it will have a fixed high value. |
| 85 | Included for historical reasons; in former times, it was used to |
| 86 | write output loops for time delays and occasionally to change |
| 87 | interfaces depending on the line speed. |
| 88 | </dl> |
| 89 | |
| 90 | <P> |
| 91 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> |
| 92 | <td><nobr><b><tt id='l2h-2003' xml:id='l2h-2003' class="function">beep</tt></b>(</nobr></td> |
| 93 | <td><var></var>)</td></tr></table></dt> |
| 94 | <dd> |
| 95 | Emit a short attention sound. |
| 96 | </dl> |
| 97 | |
| 98 | <P> |
| 99 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> |
| 100 | <td><nobr><b><tt id='l2h-2004' xml:id='l2h-2004' class="function">can_change_color</tt></b>(</nobr></td> |
| 101 | <td><var></var>)</td></tr></table></dt> |
| 102 | <dd> |
| 103 | Returns true or false, depending on whether the programmer can change |
| 104 | the colors displayed by the terminal. |
| 105 | </dl> |
| 106 | |
| 107 | <P> |
| 108 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> |
| 109 | <td><nobr><b><tt id='l2h-2005' xml:id='l2h-2005' class="function">cbreak</tt></b>(</nobr></td> |
| 110 | <td><var></var>)</td></tr></table></dt> |
| 111 | <dd> |
| 112 | Enter cbreak mode. In cbreak mode (sometimes called ``rare'' mode) |
| 113 | normal tty line buffering is turned off and characters are available |
| 114 | to be read one by one. However, unlike raw mode, special characters |
| 115 | (interrupt, quit, suspend, and flow control) retain their effects on |
| 116 | the tty driver and calling program. Calling first <tt class="function">raw()</tt> |
| 117 | then <tt class="function">cbreak()</tt> leaves the terminal in cbreak mode. |
| 118 | </dl> |
| 119 | |
| 120 | <P> |
| 121 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> |
| 122 | <td><nobr><b><tt id='l2h-2006' xml:id='l2h-2006' class="function">color_content</tt></b>(</nobr></td> |
| 123 | <td><var>color_number</var>)</td></tr></table></dt> |
| 124 | <dd> |
| 125 | Returns the intensity of the red, green, and blue (RGB) components in |
| 126 | the color <var>color_number</var>, which must be between <code>0</code> and |
| 127 | <tt class="constant">COLORS</tt>. A 3-tuple is returned, containing the R,G,B values |
| 128 | for the given color, which will be between <code>0</code> (no component) and |
| 129 | <code>1000</code> (maximum amount of component). |
| 130 | </dl> |
| 131 | |
| 132 | <P> |
| 133 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> |
| 134 | <td><nobr><b><tt id='l2h-2007' xml:id='l2h-2007' class="function">color_pair</tt></b>(</nobr></td> |
| 135 | <td><var>color_number</var>)</td></tr></table></dt> |
| 136 | <dd> |
| 137 | Returns the attribute value for displaying text in the specified |
| 138 | color. This attribute value can be combined with |
| 139 | <tt class="constant">A_STANDOUT</tt>, <tt class="constant">A_REVERSE</tt>, and the other |
| 140 | <tt class="constant">A_*</tt> attributes. <tt class="function">pair_number()</tt> is the |
| 141 | counterpart to this function. |
| 142 | </dl> |
| 143 | |
| 144 | <P> |
| 145 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> |
| 146 | <td><nobr><b><tt id='l2h-2008' xml:id='l2h-2008' class="function">curs_set</tt></b>(</nobr></td> |
| 147 | <td><var>visibility</var>)</td></tr></table></dt> |
| 148 | <dd> |
| 149 | Sets the cursor state. <var>visibility</var> can be set to 0, 1, or 2, for |
| 150 | invisible, normal, or very visible. If the terminal supports the |
| 151 | visibility requested, the previous cursor state is returned; |
| 152 | otherwise, an exception is raised. On many terminals, the ``visible'' |
| 153 | mode is an underline cursor and the ``very visible'' mode is a block cursor. |
| 154 | </dl> |
| 155 | |
| 156 | <P> |
| 157 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> |
| 158 | <td><nobr><b><tt id='l2h-2009' xml:id='l2h-2009' class="function">def_prog_mode</tt></b>(</nobr></td> |
| 159 | <td><var></var>)</td></tr></table></dt> |
| 160 | <dd> |
| 161 | Saves the current terminal mode as the ``program'' mode, the mode when |
| 162 | the running program is using curses. (Its counterpart is the |
| 163 | ``shell'' mode, for when the program is not in curses.) Subsequent calls |
| 164 | to <tt class="function">reset_prog_mode()</tt> will restore this mode. |
| 165 | </dl> |
| 166 | |
| 167 | <P> |
| 168 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> |
| 169 | <td><nobr><b><tt id='l2h-2010' xml:id='l2h-2010' class="function">def_shell_mode</tt></b>(</nobr></td> |
| 170 | <td><var></var>)</td></tr></table></dt> |
| 171 | <dd> |
| 172 | Saves the current terminal mode as the ``shell'' mode, the mode when |
| 173 | the running program is not using curses. (Its counterpart is the |
| 174 | ``program'' mode, when the program is using curses capabilities.) |
| 175 | Subsequent calls |
| 176 | to <tt class="function">reset_shell_mode()</tt> will restore this mode. |
| 177 | </dl> |
| 178 | |
| 179 | <P> |
| 180 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> |
| 181 | <td><nobr><b><tt id='l2h-2011' xml:id='l2h-2011' class="function">delay_output</tt></b>(</nobr></td> |
| 182 | <td><var>ms</var>)</td></tr></table></dt> |
| 183 | <dd> |
| 184 | Inserts an <var>ms</var> millisecond pause in output. |
| 185 | </dl> |
| 186 | |
| 187 | <P> |
| 188 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> |
| 189 | <td><nobr><b><tt id='l2h-2012' xml:id='l2h-2012' class="function">doupdate</tt></b>(</nobr></td> |
| 190 | <td><var></var>)</td></tr></table></dt> |
| 191 | <dd> |
| 192 | Update the physical screen. The curses library keeps two data |
| 193 | structures, one representing the current physical screen contents |
| 194 | and a virtual screen representing the desired next state. The |
| 195 | <tt class="function">doupdate()</tt> ground updates the physical screen to match the |
| 196 | virtual screen. |
| 197 | |
| 198 | <P> |
| 199 | The virtual screen may be updated by a <tt class="method">noutrefresh()</tt> call |
| 200 | after write operations such as <tt class="method">addstr()</tt> have been performed |
| 201 | on a window. The normal <tt class="method">refresh()</tt> call is simply |
| 202 | <tt class="method">noutrefresh()</tt> followed by <tt class="function">doupdate()</tt>; if you have |
| 203 | to update multiple windows, you can speed performance and perhaps |
| 204 | reduce screen flicker by issuing <tt class="method">noutrefresh()</tt> calls on |
| 205 | all windows, followed by a single <tt class="function">doupdate()</tt>. |
| 206 | </dl> |
| 207 | |
| 208 | <P> |
| 209 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> |
| 210 | <td><nobr><b><tt id='l2h-2013' xml:id='l2h-2013' class="function">echo</tt></b>(</nobr></td> |
| 211 | <td><var></var>)</td></tr></table></dt> |
| 212 | <dd> |
| 213 | Enter echo mode. In echo mode, each character input is echoed to the |
| 214 | screen as it is entered. |
| 215 | </dl> |
| 216 | |
| 217 | <P> |
| 218 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> |
| 219 | <td><nobr><b><tt id='l2h-2014' xml:id='l2h-2014' class="function">endwin</tt></b>(</nobr></td> |
| 220 | <td><var></var>)</td></tr></table></dt> |
| 221 | <dd> |
| 222 | De-initialize the library, and return terminal to normal status. |
| 223 | </dl> |
| 224 | |
| 225 | <P> |
| 226 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> |
| 227 | <td><nobr><b><tt id='l2h-2015' xml:id='l2h-2015' class="function">erasechar</tt></b>(</nobr></td> |
| 228 | <td><var></var>)</td></tr></table></dt> |
| 229 | <dd> |
| 230 | Returns the user's current erase character. Under <span class="Unix">Unix</span> operating |
| 231 | systems this is a property of the controlling tty of the curses |
| 232 | program, and is not set by the curses library itself. |
| 233 | </dl> |
| 234 | |
| 235 | <P> |
| 236 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> |
| 237 | <td><nobr><b><tt id='l2h-2016' xml:id='l2h-2016' class="function">filter</tt></b>(</nobr></td> |
| 238 | <td><var></var>)</td></tr></table></dt> |
| 239 | <dd> |
| 240 | The <tt class="function">filter()</tt> routine, if used, must be called before |
| 241 | <tt class="function">initscr()</tt> is called. The effect is that, during those |
| 242 | calls, LINES is set to 1; the capabilities clear, cup, cud, cud1, |
| 243 | cuu1, cuu, vpa are disabled; and the home string is set to the value of cr. |
| 244 | The effect is that the cursor is confined to the current line, and so |
| 245 | are screen updates. This may be used for enabling character-at-a-time |
| 246 | line editing without touching the rest of the screen. |
| 247 | </dl> |
| 248 | |
| 249 | <P> |
| 250 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> |
| 251 | <td><nobr><b><tt id='l2h-2017' xml:id='l2h-2017' class="function">flash</tt></b>(</nobr></td> |
| 252 | <td><var></var>)</td></tr></table></dt> |
| 253 | <dd> |
| 254 | Flash the screen. That is, change it to reverse-video and then change |
| 255 | it back in a short interval. Some people prefer such as `visible bell' |
| 256 | to the audible attention signal produced by <tt class="function">beep()</tt>. |
| 257 | </dl> |
| 258 | |
| 259 | <P> |
| 260 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> |
| 261 | <td><nobr><b><tt id='l2h-2018' xml:id='l2h-2018' class="function">flushinp</tt></b>(</nobr></td> |
| 262 | <td><var></var>)</td></tr></table></dt> |
| 263 | <dd> |
| 264 | Flush all input buffers. This throws away any typeahead that has |
| 265 | been typed by the user and has not yet been processed by the program. |
| 266 | </dl> |
| 267 | |
| 268 | <P> |
| 269 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> |
| 270 | <td><nobr><b><tt id='l2h-2019' xml:id='l2h-2019' class="function">getmouse</tt></b>(</nobr></td> |
| 271 | <td><var></var>)</td></tr></table></dt> |
| 272 | <dd> |
| 273 | After <tt class="method">getch()</tt> returns <tt class="constant">KEY_MOUSE</tt> to signal a mouse |
| 274 | event, this method should be call to retrieve the queued mouse event, |
| 275 | represented as a 5-tuple |
| 276 | <code>(<var>id</var>, <var>x</var>, <var>y</var>, <var>z</var>, <var>bstate</var>)</code>. |
| 277 | <var>id</var> is an ID value used to distinguish multiple devices, |
| 278 | and <var>x</var>, <var>y</var>, <var>z</var> are the event's coordinates. (<var>z</var> |
| 279 | is currently unused.). <var>bstate</var> is an integer value whose bits |
| 280 | will be set to indicate the type of event, and will be the bitwise OR |
| 281 | of one or more of the following constants, where <var>n</var> is the button |
| 282 | number from 1 to 4: |
| 283 | <tt class="constant">BUTTON<var>n</var>_PRESSED</tt>, |
| 284 | <tt class="constant">BUTTON<var>n</var>_RELEASED</tt>, |
| 285 | <tt class="constant">BUTTON<var>n</var>_CLICKED</tt>, |
| 286 | <tt class="constant">BUTTON<var>n</var>_DOUBLE_CLICKED</tt>, |
| 287 | <tt class="constant">BUTTON<var>n</var>_TRIPLE_CLICKED</tt>, |
| 288 | <tt class="constant">BUTTON_SHIFT</tt>, |
| 289 | <tt class="constant">BUTTON_CTRL</tt>, |
| 290 | <tt class="constant">BUTTON_ALT</tt>. |
| 291 | </dl> |
| 292 | |
| 293 | <P> |
| 294 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> |
| 295 | <td><nobr><b><tt id='l2h-2020' xml:id='l2h-2020' class="function">getsyx</tt></b>(</nobr></td> |
| 296 | <td><var></var>)</td></tr></table></dt> |
| 297 | <dd> |
| 298 | Returns the current coordinates of the virtual screen cursor in y and |
| 299 | x. If leaveok is currently true, then -1,-1 is returned. |
| 300 | </dl> |
| 301 | |
| 302 | <P> |
| 303 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> |
| 304 | <td><nobr><b><tt id='l2h-2021' xml:id='l2h-2021' class="function">getwin</tt></b>(</nobr></td> |
| 305 | <td><var>file</var>)</td></tr></table></dt> |
| 306 | <dd> |
| 307 | Reads window related data stored in the file by an earlier |
| 308 | <tt class="function">putwin()</tt> call. The routine then creates and initializes a |
| 309 | new window using that data, returning the new window object. |
| 310 | </dl> |
| 311 | |
| 312 | <P> |
| 313 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> |
| 314 | <td><nobr><b><tt id='l2h-2022' xml:id='l2h-2022' class="function">has_colors</tt></b>(</nobr></td> |
| 315 | <td><var></var>)</td></tr></table></dt> |
| 316 | <dd> |
| 317 | Returns true if the terminal can display colors; otherwise, it |
| 318 | returns false. |
| 319 | </dl> |
| 320 | |
| 321 | <P> |
| 322 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> |
| 323 | <td><nobr><b><tt id='l2h-2023' xml:id='l2h-2023' class="function">has_ic</tt></b>(</nobr></td> |
| 324 | <td><var></var>)</td></tr></table></dt> |
| 325 | <dd> |
| 326 | Returns true if the terminal has insert- and delete- character |
| 327 | capabilities. This function is included for historical reasons only, |
| 328 | as all modern software terminal emulators have such capabilities. |
| 329 | </dl> |
| 330 | |
| 331 | <P> |
| 332 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> |
| 333 | <td><nobr><b><tt id='l2h-2024' xml:id='l2h-2024' class="function">has_il</tt></b>(</nobr></td> |
| 334 | <td><var></var>)</td></tr></table></dt> |
| 335 | <dd> |
| 336 | Returns true if the terminal has insert- and |
| 337 | delete-line capabilities, or can simulate them using |
| 338 | scrolling regions. This function is included for historical reasons only, |
| 339 | as all modern software terminal emulators have such capabilities. |
| 340 | </dl> |
| 341 | |
| 342 | <P> |
| 343 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> |
| 344 | <td><nobr><b><tt id='l2h-2025' xml:id='l2h-2025' class="function">has_key</tt></b>(</nobr></td> |
| 345 | <td><var>ch</var>)</td></tr></table></dt> |
| 346 | <dd> |
| 347 | Takes a key value <var>ch</var>, and returns true if the current terminal |
| 348 | type recognizes a key with that value. |
| 349 | </dl> |
| 350 | |
| 351 | <P> |
| 352 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> |
| 353 | <td><nobr><b><tt id='l2h-2026' xml:id='l2h-2026' class="function">halfdelay</tt></b>(</nobr></td> |
| 354 | <td><var>tenths</var>)</td></tr></table></dt> |
| 355 | <dd> |
| 356 | Used for half-delay mode, which is similar to cbreak mode in that |
| 357 | characters typed by the user are immediately available to the program. |
| 358 | However, after blocking for <var>tenths</var> tenths of seconds, an |
| 359 | exception is raised if nothing has been typed. The value of |
| 360 | <var>tenths</var> must be a number between 1 and 255. Use |
| 361 | <tt class="function">nocbreak()</tt> to leave half-delay mode. |
| 362 | </dl> |
| 363 | |
| 364 | <P> |
| 365 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> |
| 366 | <td><nobr><b><tt id='l2h-2027' xml:id='l2h-2027' class="function">init_color</tt></b>(</nobr></td> |
| 367 | <td><var>color_number, r, g, b</var>)</td></tr></table></dt> |
| 368 | <dd> |
| 369 | Changes the definition of a color, taking the number of the color to |
| 370 | be changed followed by three RGB values (for the amounts of red, |
| 371 | green, and blue components). The value of <var>color_number</var> must be |
| 372 | between <code>0</code> and <tt class="constant">COLORS</tt>. Each of <var>r</var>, <var>g</var>, |
| 373 | <var>b</var>, must be a value between <code>0</code> and <code>1000</code>. When |
| 374 | <tt class="function">init_color()</tt> is used, all occurrences of that color on the |
| 375 | screen immediately change to the new definition. This function is a |
| 376 | no-op on most terminals; it is active only if |
| 377 | <tt class="function">can_change_color()</tt> returns <code>1</code>. |
| 378 | </dl> |
| 379 | |
| 380 | <P> |
| 381 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> |
| 382 | <td><nobr><b><tt id='l2h-2028' xml:id='l2h-2028' class="function">init_pair</tt></b>(</nobr></td> |
| 383 | <td><var>pair_number, fg, bg</var>)</td></tr></table></dt> |
| 384 | <dd> |
| 385 | Changes the definition of a color-pair. It takes three arguments: the |
| 386 | number of the color-pair to be changed, the foreground color number, |
| 387 | and the background color number. The value of <var>pair_number</var> must |
| 388 | be between <code>1</code> and <code>COLOR_PAIRS - 1</code> (the <code>0</code> color |
| 389 | pair is wired to white on black and cannot be changed). The value of |
| 390 | <var>fg</var> and <var>bg</var> arguments must be between <code>0</code> and |
| 391 | <tt class="constant">COLORS</tt>. If the color-pair was previously initialized, the |
| 392 | screen is refreshed and all occurrences of that color-pair are changed |
| 393 | to the new definition. |
| 394 | </dl> |
| 395 | |
| 396 | <P> |
| 397 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> |
| 398 | <td><nobr><b><tt id='l2h-2029' xml:id='l2h-2029' class="function">initscr</tt></b>(</nobr></td> |
| 399 | <td><var></var>)</td></tr></table></dt> |
| 400 | <dd> |
| 401 | Initialize the library. Returns a <tt class="class">WindowObject</tt> which represents |
| 402 | the whole screen. <span class="note"><b class="label">Note:</b> |
| 403 | If there is an error opening the terminal, |
| 404 | the underlying curses library may cause the interpreter to exit.</span> |
| 405 | </dl> |
| 406 | |
| 407 | <P> |
| 408 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> |
| 409 | <td><nobr><b><tt id='l2h-2030' xml:id='l2h-2030' class="function">isendwin</tt></b>(</nobr></td> |
| 410 | <td><var></var>)</td></tr></table></dt> |
| 411 | <dd> |
| 412 | Returns true if <tt class="function">endwin()</tt> has been called (that is, the |
| 413 | curses library has been deinitialized). |
| 414 | </dl> |
| 415 | |
| 416 | <P> |
| 417 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> |
| 418 | <td><nobr><b><tt id='l2h-2031' xml:id='l2h-2031' class="function">keyname</tt></b>(</nobr></td> |
| 419 | <td><var>k</var>)</td></tr></table></dt> |
| 420 | <dd> |
| 421 | Return the name of the key numbered <var>k</var>. The name of a key |
| 422 | generating printable ASCII character is the key's character. The name |
| 423 | of a control-key combination is a two-character string consisting of a |
| 424 | caret followed by the corresponding printable ASCII character. The |
| 425 | name of an alt-key combination (128-255) is a string consisting of the |
| 426 | prefix `M-' followed by the name of the corresponding ASCII character. |
| 427 | </dl> |
| 428 | |
| 429 | <P> |
| 430 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> |
| 431 | <td><nobr><b><tt id='l2h-2032' xml:id='l2h-2032' class="function">killchar</tt></b>(</nobr></td> |
| 432 | <td><var></var>)</td></tr></table></dt> |
| 433 | <dd> |
| 434 | Returns the user's current line kill character. Under <span class="Unix">Unix</span> operating |
| 435 | systems this is a property of the controlling tty of the curses |
| 436 | program, and is not set by the curses library itself. |
| 437 | </dl> |
| 438 | |
| 439 | <P> |
| 440 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> |
| 441 | <td><nobr><b><tt id='l2h-2033' xml:id='l2h-2033' class="function">longname</tt></b>(</nobr></td> |
| 442 | <td><var></var>)</td></tr></table></dt> |
| 443 | <dd> |
| 444 | Returns a string containing the terminfo long name field describing the current |
| 445 | terminal. The maximum length of a verbose description is 128 |
| 446 | characters. It is defined only after the call to |
| 447 | <tt class="function">initscr()</tt>. |
| 448 | </dl> |
| 449 | |
| 450 | <P> |
| 451 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> |
| 452 | <td><nobr><b><tt id='l2h-2034' xml:id='l2h-2034' class="function">meta</tt></b>(</nobr></td> |
| 453 | <td><var>yes</var>)</td></tr></table></dt> |
| 454 | <dd> |
| 455 | If <var>yes</var> is 1, allow 8-bit characters to be input. If <var>yes</var> is 0, |
| 456 | allow only 7-bit chars. |
| 457 | </dl> |
| 458 | |
| 459 | <P> |
| 460 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> |
| 461 | <td><nobr><b><tt id='l2h-2035' xml:id='l2h-2035' class="function">mouseinterval</tt></b>(</nobr></td> |
| 462 | <td><var>interval</var>)</td></tr></table></dt> |
| 463 | <dd> |
| 464 | Sets the maximum time in milliseconds that can elapse between press and |
| 465 | release events in order for them to be recognized as a click, and |
| 466 | returns the previous interval value. The default value is 200 msec, |
| 467 | or one fifth of a second. |
| 468 | </dl> |
| 469 | |
| 470 | <P> |
| 471 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> |
| 472 | <td><nobr><b><tt id='l2h-2036' xml:id='l2h-2036' class="function">mousemask</tt></b>(</nobr></td> |
| 473 | <td><var>mousemask</var>)</td></tr></table></dt> |
| 474 | <dd> |
| 475 | Sets the mouse events to be reported, and returns a tuple |
| 476 | <code>(<var>availmask</var>, <var>oldmask</var>)</code>. |
| 477 | <var>availmask</var> indicates which of the |
| 478 | specified mouse events can be reported; on complete failure it returns |
| 479 | 0. <var>oldmask</var> is the previous value of the given window's mouse |
| 480 | event mask. If this function is never called, no mouse events are |
| 481 | ever reported. |
| 482 | </dl> |
| 483 | |
| 484 | <P> |
| 485 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> |
| 486 | <td><nobr><b><tt id='l2h-2037' xml:id='l2h-2037' class="function">napms</tt></b>(</nobr></td> |
| 487 | <td><var>ms</var>)</td></tr></table></dt> |
| 488 | <dd> |
| 489 | Sleep for <var>ms</var> milliseconds. |
| 490 | </dl> |
| 491 | |
| 492 | <P> |
| 493 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> |
| 494 | <td><nobr><b><tt id='l2h-2038' xml:id='l2h-2038' class="function">newpad</tt></b>(</nobr></td> |
| 495 | <td><var>nlines, ncols</var>)</td></tr></table></dt> |
| 496 | <dd> |
| 497 | Creates and returns a pointer to a new pad data structure with the |
| 498 | given number of lines and columns. A pad is returned as a |
| 499 | window object. |
| 500 | |
| 501 | <P> |
| 502 | A pad is like a window, except that it is not restricted by the screen |
| 503 | size, and is not necessarily associated with a particular part of the |
| 504 | screen. Pads can be used when a large window is needed, and only a |
| 505 | part of the window will be on the screen at one time. Automatic |
| 506 | refreshes of pads (such as from scrolling or echoing of input) do not |
| 507 | occur. The <tt class="method">refresh()</tt> and <tt class="method">noutrefresh()</tt> methods of a |
| 508 | pad require 6 arguments to specify the part of the pad to be |
| 509 | displayed and the location on the screen to be used for the display. |
| 510 | The arguments are pminrow, pmincol, sminrow, smincol, smaxrow, |
| 511 | smaxcol; the p arguments refer to the upper left corner of the pad |
| 512 | region to be displayed and the s arguments define a clipping box on |
| 513 | the screen within which the pad region is to be displayed. |
| 514 | </dl> |
| 515 | |
| 516 | <P> |
| 517 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> |
| 518 | <td><nobr><b><tt id='l2h-2039' xml:id='l2h-2039' class="function">newwin</tt></b>(</nobr></td> |
| 519 | <td><var></var><big>[</big><var>nlines, ncols,</var><big>]</big><var> begin_y, begin_x</var>)</td></tr></table></dt> |
| 520 | <dd> |
| 521 | Return a new window, whose left-upper corner is at |
| 522 | <code>(<var>begin_y</var>, <var>begin_x</var>)</code>, and whose height/width is |
| 523 | <var>nlines</var>/<var>ncols</var>. |
| 524 | |
| 525 | <P> |
| 526 | By default, the window will extend from the |
| 527 | specified position to the lower right corner of the screen. |
| 528 | </dl> |
| 529 | |
| 530 | <P> |
| 531 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> |
| 532 | <td><nobr><b><tt id='l2h-2040' xml:id='l2h-2040' class="function">nl</tt></b>(</nobr></td> |
| 533 | <td><var></var>)</td></tr></table></dt> |
| 534 | <dd> |
| 535 | Enter newline mode. This mode translates the return key into newline |
| 536 | on input, and translates newline into return and line-feed on output. |
| 537 | Newline mode is initially on. |
| 538 | </dl> |
| 539 | |
| 540 | <P> |
| 541 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> |
| 542 | <td><nobr><b><tt id='l2h-2041' xml:id='l2h-2041' class="function">nocbreak</tt></b>(</nobr></td> |
| 543 | <td><var></var>)</td></tr></table></dt> |
| 544 | <dd> |
| 545 | Leave cbreak mode. Return to normal ``cooked'' mode with line buffering. |
| 546 | </dl> |
| 547 | |
| 548 | <P> |
| 549 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> |
| 550 | <td><nobr><b><tt id='l2h-2042' xml:id='l2h-2042' class="function">noecho</tt></b>(</nobr></td> |
| 551 | <td><var></var>)</td></tr></table></dt> |
| 552 | <dd> |
| 553 | Leave echo mode. Echoing of input characters is turned off. |
| 554 | </dl> |
| 555 | |
| 556 | <P> |
| 557 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> |
| 558 | <td><nobr><b><tt id='l2h-2043' xml:id='l2h-2043' class="function">nonl</tt></b>(</nobr></td> |
| 559 | <td><var></var>)</td></tr></table></dt> |
| 560 | <dd> |
| 561 | Leave newline mode. Disable translation of return into newline on |
| 562 | input, and disable low-level translation of newline into |
| 563 | newline/return on output (but this does not change the behavior of |
| 564 | <code>addch('\n')</code>, which always does the equivalent of return and |
| 565 | line feed on the virtual screen). With translation off, curses can |
| 566 | sometimes speed up vertical motion a little; also, it will be able to |
| 567 | detect the return key on input. |
| 568 | </dl> |
| 569 | |
| 570 | <P> |
| 571 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> |
| 572 | <td><nobr><b><tt id='l2h-2044' xml:id='l2h-2044' class="function">noqiflush</tt></b>(</nobr></td> |
| 573 | <td><var></var>)</td></tr></table></dt> |
| 574 | <dd> |
| 575 | When the noqiflush routine is used, normal flush of input and |
| 576 | output queues associated with the INTR, QUIT and SUSP |
| 577 | characters will not be done. You may want to call |
| 578 | <tt class="function">noqiflush()</tt> in a signal handler if you want output |
| 579 | to continue as though the interrupt had not occurred, after the |
| 580 | handler exits. |
| 581 | </dl> |
| 582 | |
| 583 | <P> |
| 584 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> |
| 585 | <td><nobr><b><tt id='l2h-2045' xml:id='l2h-2045' class="function">noraw</tt></b>(</nobr></td> |
| 586 | <td><var></var>)</td></tr></table></dt> |
| 587 | <dd> |
| 588 | Leave raw mode. Return to normal ``cooked'' mode with line buffering. |
| 589 | </dl> |
| 590 | |
| 591 | <P> |
| 592 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> |
| 593 | <td><nobr><b><tt id='l2h-2046' xml:id='l2h-2046' class="function">pair_content</tt></b>(</nobr></td> |
| 594 | <td><var>pair_number</var>)</td></tr></table></dt> |
| 595 | <dd> |
| 596 | Returns a tuple <code>(<var>fg</var>, <var>bg</var>)</code> containing the colors for |
| 597 | the requested color pair. The value of <var>pair_number</var> must be |
| 598 | between <code>1</code> and <code><tt class="constant">COLOR_PAIRS</tt> - 1</code>. |
| 599 | </dl> |
| 600 | |
| 601 | <P> |
| 602 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> |
| 603 | <td><nobr><b><tt id='l2h-2047' xml:id='l2h-2047' class="function">pair_number</tt></b>(</nobr></td> |
| 604 | <td><var>attr</var>)</td></tr></table></dt> |
| 605 | <dd> |
| 606 | Returns the number of the color-pair set by the attribute value |
| 607 | <var>attr</var>. <tt class="function">color_pair()</tt> is the counterpart to this |
| 608 | function. |
| 609 | </dl> |
| 610 | |
| 611 | <P> |
| 612 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> |
| 613 | <td><nobr><b><tt id='l2h-2048' xml:id='l2h-2048' class="function">putp</tt></b>(</nobr></td> |
| 614 | <td><var>string</var>)</td></tr></table></dt> |
| 615 | <dd> |
| 616 | Equivalent to <code>tputs(str, 1, putchar)</code>; emits the value of a |
| 617 | specified terminfo capability for the current terminal. Note that the |
| 618 | output of putp always goes to standard output. |
| 619 | </dl> |
| 620 | |
| 621 | <P> |
| 622 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> |
| 623 | <td><nobr><b><tt id='l2h-2049' xml:id='l2h-2049' class="function">qiflush</tt></b>(</nobr></td> |
| 624 | <td><var> </var><big>[</big><var>flag</var><big>]</big><var> </var>)</td></tr></table></dt> |
| 625 | <dd> |
| 626 | If <var>flag</var> is false, the effect is the same as calling |
| 627 | <tt class="function">noqiflush()</tt>. If <var>flag</var> is true, or no argument is |
| 628 | provided, the queues will be flushed when these control characters are |
| 629 | read. |
| 630 | </dl> |
| 631 | |
| 632 | <P> |
| 633 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> |
| 634 | <td><nobr><b><tt id='l2h-2050' xml:id='l2h-2050' class="function">raw</tt></b>(</nobr></td> |
| 635 | <td><var></var>)</td></tr></table></dt> |
| 636 | <dd> |
| 637 | Enter raw mode. In raw mode, normal line buffering and |
| 638 | processing of interrupt, quit, suspend, and flow control keys are |
| 639 | turned off; characters are presented to curses input functions one |
| 640 | by one. |
| 641 | </dl> |
| 642 | |
| 643 | <P> |
| 644 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> |
| 645 | <td><nobr><b><tt id='l2h-2051' xml:id='l2h-2051' class="function">reset_prog_mode</tt></b>(</nobr></td> |
| 646 | <td><var></var>)</td></tr></table></dt> |
| 647 | <dd> |
| 648 | Restores the terminal to ``program'' mode, as previously saved |
| 649 | by <tt class="function">def_prog_mode()</tt>. |
| 650 | </dl> |
| 651 | |
| 652 | <P> |
| 653 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> |
| 654 | <td><nobr><b><tt id='l2h-2052' xml:id='l2h-2052' class="function">reset_shell_mode</tt></b>(</nobr></td> |
| 655 | <td><var></var>)</td></tr></table></dt> |
| 656 | <dd> |
| 657 | Restores the terminal to ``shell'' mode, as previously saved |
| 658 | by <tt class="function">def_shell_mode()</tt>. |
| 659 | </dl> |
| 660 | |
| 661 | <P> |
| 662 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> |
| 663 | <td><nobr><b><tt id='l2h-2053' xml:id='l2h-2053' class="function">setsyx</tt></b>(</nobr></td> |
| 664 | <td><var>y, x</var>)</td></tr></table></dt> |
| 665 | <dd> |
| 666 | Sets the virtual screen cursor to <var>y</var>, <var>x</var>. |
| 667 | If <var>y</var> and <var>x</var> are both -1, then leaveok is set. |
| 668 | </dl> |
| 669 | |
| 670 | <P> |
| 671 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> |
| 672 | <td><nobr><b><tt id='l2h-2054' xml:id='l2h-2054' class="function">setupterm</tt></b>(</nobr></td> |
| 673 | <td><var></var><big>[</big><var>termstr, fd</var><big>]</big><var></var>)</td></tr></table></dt> |
| 674 | <dd> |
| 675 | Initializes the terminal. <var>termstr</var> is a string giving the |
| 676 | terminal name; if omitted, the value of the TERM environment variable |
| 677 | will be used. <var>fd</var> is the file descriptor to which any |
| 678 | initialization sequences will be sent; if not supplied, the file |
| 679 | descriptor for <code>sys.stdout</code> will be used. |
| 680 | </dl> |
| 681 | |
| 682 | <P> |
| 683 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> |
| 684 | <td><nobr><b><tt id='l2h-2055' xml:id='l2h-2055' class="function">start_color</tt></b>(</nobr></td> |
| 685 | <td><var></var>)</td></tr></table></dt> |
| 686 | <dd> |
| 687 | Must be called if the programmer wants to use colors, and before any |
| 688 | other color manipulation routine is called. It is good |
| 689 | practice to call this routine right after <tt class="function">initscr()</tt>. |
| 690 | |
| 691 | <P> |
| 692 | <tt class="function">start_color()</tt> initializes eight basic colors (black, red, |
| 693 | green, yellow, blue, magenta, cyan, and white), and two global |
| 694 | variables in the <tt class="module">curses</tt> module, <tt class="constant">COLORS</tt> and |
| 695 | <tt class="constant">COLOR_PAIRS</tt>, containing the maximum number of colors and |
| 696 | color-pairs the terminal can support. It also restores the colors on |
| 697 | the terminal to the values they had when the terminal was just turned |
| 698 | on. |
| 699 | </dl> |
| 700 | |
| 701 | <P> |
| 702 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> |
| 703 | <td><nobr><b><tt id='l2h-2056' xml:id='l2h-2056' class="function">termattrs</tt></b>(</nobr></td> |
| 704 | <td><var></var>)</td></tr></table></dt> |
| 705 | <dd> |
| 706 | Returns a logical OR of all video attributes supported by the |
| 707 | terminal. This information is useful when a curses program needs |
| 708 | complete control over the appearance of the screen. |
| 709 | </dl> |
| 710 | |
| 711 | <P> |
| 712 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> |
| 713 | <td><nobr><b><tt id='l2h-2057' xml:id='l2h-2057' class="function">termname</tt></b>(</nobr></td> |
| 714 | <td><var></var>)</td></tr></table></dt> |
| 715 | <dd> |
| 716 | Returns the value of the environment variable TERM, truncated to 14 |
| 717 | characters. |
| 718 | </dl> |
| 719 | |
| 720 | <P> |
| 721 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> |
| 722 | <td><nobr><b><tt id='l2h-2058' xml:id='l2h-2058' class="function">tigetflag</tt></b>(</nobr></td> |
| 723 | <td><var>capname</var>)</td></tr></table></dt> |
| 724 | <dd> |
| 725 | Returns the value of the Boolean capability corresponding to the |
| 726 | terminfo capability name <var>capname</var>. The value <code>-1</code> is |
| 727 | returned if <var>capname</var> is not a Boolean capability, or <code>0</code> if |
| 728 | it is canceled or absent from the terminal description. |
| 729 | </dl> |
| 730 | |
| 731 | <P> |
| 732 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> |
| 733 | <td><nobr><b><tt id='l2h-2059' xml:id='l2h-2059' class="function">tigetnum</tt></b>(</nobr></td> |
| 734 | <td><var>capname</var>)</td></tr></table></dt> |
| 735 | <dd> |
| 736 | Returns the value of the numeric capability corresponding to the |
| 737 | terminfo capability name <var>capname</var>. The value <code>-2</code> is |
| 738 | returned if <var>capname</var> is not a numeric capability, or <code>-1</code> if |
| 739 | it is canceled or absent from the terminal description. |
| 740 | </dl> |
| 741 | |
| 742 | <P> |
| 743 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> |
| 744 | <td><nobr><b><tt id='l2h-2060' xml:id='l2h-2060' class="function">tigetstr</tt></b>(</nobr></td> |
| 745 | <td><var>capname</var>)</td></tr></table></dt> |
| 746 | <dd> |
| 747 | Returns the value of the string capability corresponding to the |
| 748 | terminfo capability name <var>capname</var>. <code>None</code> is returned if |
| 749 | <var>capname</var> is not a string capability, or is canceled or absent |
| 750 | from the terminal description. |
| 751 | </dl> |
| 752 | |
| 753 | <P> |
| 754 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> |
| 755 | <td><nobr><b><tt id='l2h-2061' xml:id='l2h-2061' class="function">tparm</tt></b>(</nobr></td> |
| 756 | <td><var>str</var><big>[</big><var>,...</var><big>]</big><var></var>)</td></tr></table></dt> |
| 757 | <dd> |
| 758 | Instantiates the string <var>str</var> with the supplied parameters, where |
| 759 | <var>str</var> should be a parameterized string obtained from the terminfo |
| 760 | database. E.g. <code>tparm(tigetstr("cup"), 5, 3)</code> could result in |
| 761 | <code>'\033[6;4H'</code>, the exact result depending on terminal type. |
| 762 | </dl> |
| 763 | |
| 764 | <P> |
| 765 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> |
| 766 | <td><nobr><b><tt id='l2h-2062' xml:id='l2h-2062' class="function">typeahead</tt></b>(</nobr></td> |
| 767 | <td><var>fd</var>)</td></tr></table></dt> |
| 768 | <dd> |
| 769 | Specifies that the file descriptor <var>fd</var> be used for typeahead |
| 770 | checking. If <var>fd</var> is <code>-1</code>, then no typeahead checking is |
| 771 | done. |
| 772 | |
| 773 | <P> |
| 774 | The curses library does ``line-breakout optimization'' by looking for |
| 775 | typeahead periodically while updating the screen. If input is found, |
| 776 | and it is coming from a tty, the current update is postponed until |
| 777 | refresh or doupdate is called again, allowing faster response to |
| 778 | commands typed in advance. This function allows specifying a different |
| 779 | file descriptor for typeahead checking. |
| 780 | </dl> |
| 781 | |
| 782 | <P> |
| 783 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> |
| 784 | <td><nobr><b><tt id='l2h-2063' xml:id='l2h-2063' class="function">unctrl</tt></b>(</nobr></td> |
| 785 | <td><var>ch</var>)</td></tr></table></dt> |
| 786 | <dd> |
| 787 | Returns a string which is a printable representation of the character |
| 788 | <var>ch</var>. Control characters are displayed as a caret followed by the |
| 789 | character, for example as <code>^C</code>. Printing |
| 790 | characters are left as they are. |
| 791 | </dl> |
| 792 | |
| 793 | <P> |
| 794 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> |
| 795 | <td><nobr><b><tt id='l2h-2064' xml:id='l2h-2064' class="function">ungetch</tt></b>(</nobr></td> |
| 796 | <td><var>ch</var>)</td></tr></table></dt> |
| 797 | <dd> |
| 798 | Push <var>ch</var> so the next <tt class="method">getch()</tt> will return it. |
| 799 | <span class="note"><b class="label">Note:</b> |
| 800 | Only one <var>ch</var> can be pushed before <tt class="method">getch()</tt> |
| 801 | is called.</span> |
| 802 | </dl> |
| 803 | |
| 804 | <P> |
| 805 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> |
| 806 | <td><nobr><b><tt id='l2h-2065' xml:id='l2h-2065' class="function">ungetmouse</tt></b>(</nobr></td> |
| 807 | <td><var>id, x, y, z, bstate</var>)</td></tr></table></dt> |
| 808 | <dd> |
| 809 | Push a <tt class="constant">KEY_MOUSE</tt> event onto the input queue, associating |
| 810 | the given state data with it. |
| 811 | </dl> |
| 812 | |
| 813 | <P> |
| 814 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> |
| 815 | <td><nobr><b><tt id='l2h-2066' xml:id='l2h-2066' class="function">use_env</tt></b>(</nobr></td> |
| 816 | <td><var>flag</var>)</td></tr></table></dt> |
| 817 | <dd> |
| 818 | If used, this function should be called before <tt class="function">initscr()</tt> or |
| 819 | newterm are called. When <var>flag</var> is false, the values of |
| 820 | lines and columns specified in the terminfo database will be |
| 821 | used, even if environment variables <a class="envvar" id='l2h-2068' xml:id='l2h-2068'>LINES</a> and |
| 822 | <a class="envvar" id='l2h-2069' xml:id='l2h-2069'>COLUMNS</a> (used by default) are set, or if curses is running in |
| 823 | a window (in which case default behavior would be to use the window |
| 824 | size if <a class="envvar" id='l2h-2070' xml:id='l2h-2070'>LINES</a> and <a class="envvar" id='l2h-2071' xml:id='l2h-2071'>COLUMNS</a> are not set). |
| 825 | </dl> |
| 826 | |
| 827 | <P> |
| 828 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> |
| 829 | <td><nobr><b><tt id='l2h-2067' xml:id='l2h-2067' class="function">use_default_colors</tt></b>(</nobr></td> |
| 830 | <td><var></var>)</td></tr></table></dt> |
| 831 | <dd> |
| 832 | Allow use of default values for colors on terminals supporting this |
| 833 | feature. Use this to support transparency in your |
| 834 | application. The default color is assigned to the color number -1. |
| 835 | After calling this function, |
| 836 | <code>init_pair(x, curses.COLOR_RED, -1)</code> initializes, for instance, |
| 837 | color pair <var>x</var> to a red foreground color on the default background. |
| 838 | </dl> |
| 839 | |
| 840 | <P> |
| 841 | |
| 842 | <DIV CLASS="navigation"> |
| 843 | <div class='online-navigation'> |
| 844 | <p></p><hr /> |
| 845 | <table align="center" width="100%" cellpadding="0" cellspacing="2"> |
| 846 | <tr> |
| 847 | <td class='online-navigation'><a rel="prev" title="6.15 curses " |
| 848 | href="module-curses.html"><img src='../icons/previous.png' |
| 849 | border='0' height='32' alt='Previous Page' width='32' /></A></td> |
| 850 | <td class='online-navigation'><a rel="parent" title="6.15 curses " |
| 851 | href="module-curses.html"><img src='../icons/up.png' |
| 852 | border='0' height='32' alt='Up One Level' width='32' /></A></td> |
| 853 | <td class='online-navigation'><a rel="next" title="6.15.2 Window Objects" |
| 854 | href="curses-window-objects.html"><img src='../icons/next.png' |
| 855 | border='0' height='32' alt='Next Page' width='32' /></A></td> |
| 856 | <td align="center" width="100%">Python Library Reference</td> |
| 857 | <td class='online-navigation'><a rel="contents" title="Table of Contents" |
| 858 | href="contents.html"><img src='../icons/contents.png' |
| 859 | border='0' height='32' alt='Contents' width='32' /></A></td> |
| 860 | <td class='online-navigation'><a href="modindex.html" title="Module Index"><img src='../icons/modules.png' |
| 861 | border='0' height='32' alt='Module Index' width='32' /></a></td> |
| 862 | <td class='online-navigation'><a rel="index" title="Index" |
| 863 | href="genindex.html"><img src='../icons/index.png' |
| 864 | border='0' height='32' alt='Index' width='32' /></A></td> |
| 865 | </tr></table> |
| 866 | <div class='online-navigation'> |
| 867 | <b class="navlabel">Previous:</b> |
| 868 | <a class="sectref" rel="prev" href="module-curses.html">6.15 curses </A> |
| 869 | <b class="navlabel">Up:</b> |
| 870 | <a class="sectref" rel="parent" href="module-curses.html">6.15 curses </A> |
| 871 | <b class="navlabel">Next:</b> |
| 872 | <a class="sectref" rel="next" href="curses-window-objects.html">6.15.2 Window Objects</A> |
| 873 | </div> |
| 874 | </div> |
| 875 | <hr /> |
| 876 | <span class="release-info">Release 2.4.2, documentation updated on 28 September 2005.</span> |
| 877 | </DIV> |
| 878 | <!--End of Navigation Panel--> |
| 879 | <ADDRESS> |
| 880 | See <i><a href="about.html">About this document...</a></i> for information on suggesting changes. |
| 881 | </ADDRESS> |
| 882 | </BODY> |
| 883 | </HTML> |