Initial commit of OpenSPARC T2 architecture model.
[OpenSPARC-T2-SAM] / sam-t2 / devtools / amd64 / html / python / lib / curses-window-objects.html
CommitLineData
920dae64
AT
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="node267.html" />
13<link rel="prev" href="curses-functions.html" />
14<link rel="parent" href="module-curses.html" />
15<link rel="next" href="node267.html" />
16<meta name='aesop' content='information' />
17<title>6.15.2 Window Objects </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.1 Functions"
25 href="curses-functions.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.3 Constants"
31 href="node267.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="curses-functions.html">6.15.1 Functions</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="node267.html">6.15.3 Constants</A>
50</div>
51<hr /></div>
52</DIV>
53<!--End of Navigation Panel-->
54
55<H2><A NAME="SECTION0081520000000000000000"></A><A NAME="curses-window-objects"></A>
56<BR>
576.15.2 Window Objects
58</H2>
59
60<P>
61Window objects, as returned by <tt class="function">initscr()</tt> and
62<tt class="function">newwin()</tt> above, have the
63following methods:
64
65<P>
66<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
67 <td><nobr><b><tt id='l2h-2072' xml:id='l2h-2072' class="method">addch</tt></b>(</nobr></td>
68 <td><var></var><big>[</big><var>y, x,</var><big>]</big><var> ch</var><big>[</big><var>, attr</var><big>]</big><var></var>)</td></tr></table></dt>
69<dd>
70<span class="note"><b class="label">Note:</b>
71A <em>character</em> means a C character (an
72ASCII code), rather then a Python character (a string of length 1).
73(This note is true whenever the documentation mentions a character.)
74The builtin <tt class="function">ord()</tt> is handy for conveying strings to codes.</span>
75
76<P>
77Paint character <var>ch</var> at <code>(<var>y</var>, <var>x</var>)</code> with attributes
78<var>attr</var>, overwriting any character previously painter at that
79location. By default, the character position and attributes are the
80current settings for the window object.
81</dl>
82
83<P>
84<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
85 <td><nobr><b><tt id='l2h-2073' xml:id='l2h-2073' class="method">addnstr</tt></b>(</nobr></td>
86 <td><var></var><big>[</big><var>y, x,</var><big>]</big><var> str, n</var><big>[</big><var>, attr</var><big>]</big><var></var>)</td></tr></table></dt>
87<dd>
88Paint at most <var>n</var> characters of the
89string <var>str</var> at <code>(<var>y</var>, <var>x</var>)</code> with attributes
90<var>attr</var>, overwriting anything previously on the display.
91</dl>
92
93<P>
94<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
95 <td><nobr><b><tt id='l2h-2074' xml:id='l2h-2074' class="method">addstr</tt></b>(</nobr></td>
96 <td><var></var><big>[</big><var>y, x,</var><big>]</big><var> str</var><big>[</big><var>, attr</var><big>]</big><var></var>)</td></tr></table></dt>
97<dd>
98Paint the string <var>str</var> at <code>(<var>y</var>, <var>x</var>)</code> with attributes
99<var>attr</var>, overwriting anything previously on the display.
100</dl>
101
102<P>
103<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
104 <td><nobr><b><tt id='l2h-2075' xml:id='l2h-2075' class="method">attroff</tt></b>(</nobr></td>
105 <td><var>attr</var>)</td></tr></table></dt>
106<dd>
107Remove attribute <var>attr</var> from the ``background'' set applied to all
108writes to the current window.
109</dl>
110
111<P>
112<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
113 <td><nobr><b><tt id='l2h-2076' xml:id='l2h-2076' class="method">attron</tt></b>(</nobr></td>
114 <td><var>attr</var>)</td></tr></table></dt>
115<dd>
116Add attribute <var>attr</var> from the ``background'' set applied to all
117writes to the current window.
118</dl>
119
120<P>
121<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
122 <td><nobr><b><tt id='l2h-2077' xml:id='l2h-2077' class="method">attrset</tt></b>(</nobr></td>
123 <td><var>attr</var>)</td></tr></table></dt>
124<dd>
125Set the ``background'' set of attributes to <var>attr</var>. This set is
126initially 0 (no attributes).
127</dl>
128
129<P>
130<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
131 <td><nobr><b><tt id='l2h-2078' xml:id='l2h-2078' class="method">bkgd</tt></b>(</nobr></td>
132 <td><var>ch</var><big>[</big><var>, attr</var><big>]</big><var></var>)</td></tr></table></dt>
133<dd>
134Sets the background property of the window to the character <var>ch</var>,
135with attributes <var>attr</var>. The change is then applied to every
136character position in that window:
137
138<UL>
139<LI>The attribute of every character in the window is
140changed to the new background attribute.
141</LI>
142<LI>Wherever the former background character appears,
143it is changed to the new background character.
144</LI>
145</UL>
146
147<P>
148</dl>
149
150<P>
151<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
152 <td><nobr><b><tt id='l2h-2079' xml:id='l2h-2079' class="method">bkgdset</tt></b>(</nobr></td>
153 <td><var>ch</var><big>[</big><var>, attr</var><big>]</big><var></var>)</td></tr></table></dt>
154<dd>
155Sets the window's background. A window's background consists of a
156character and any combination of attributes. The attribute part of
157the background is combined (OR'ed) with all non-blank characters that
158are written into the window. Both the character and attribute parts
159of the background are combined with the blank characters. The
160background becomes a property of the character and moves with the
161character through any scrolling and insert/delete line/character
162operations.
163</dl>
164
165<P>
166<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
167 <td><nobr><b><tt id='l2h-2080' xml:id='l2h-2080' class="method">border</tt></b>(</nobr></td>
168 <td><var></var><big>[</big><var>ls</var><big>[</big><var>, rs</var><big>[</big><var>,
169 ts</var><big>[</big><var>, bs</var><big>[</big><var>, tl</var><big>[</big><var>,
170 tr</var><big>[</big><var>, bl</var><big>[</big><var>, br</var><big>]</big><var></var><big>]</big><var></var><big>]</big><var></var><big>]</big><var></var><big>]</big><var></var><big>]</big><var></var><big>]</big><var></var><big>]</big><var></var>)</td></tr></table></dt>
171<dd>
172Draw a border around the edges of the window. Each parameter specifies
173the character to use for a specific part of the border; see the table
174below for more details. The characters can be specified as integers
175or as one-character strings.
176
177<P>
178<span class="note"><b class="label">Note:</b>
179A <code>0</code> value for any parameter will cause the
180default character to be used for that parameter. Keyword parameters
181can <em>not</em> be used. The defaults are listed in this table:</span>
182
183<P>
184<div class="center"><table class="realtable">
185 <thead>
186 <tr>
187 <th class="left" >Parameter</th>
188 <th class="left" >Description</th>
189 <th class="left" >Default value</th>
190 </tr>
191 </thead>
192 <tbody>
193 <tr><td class="left" valign="baseline"><var>ls</var></td>
194 <td class="left" >Left side</td>
195 <td class="left" ><tt class="constant">ACS_VLINE</tt></td></tr>
196 <tr><td class="left" valign="baseline"><var>rs</var></td>
197 <td class="left" >Right side</td>
198 <td class="left" ><tt class="constant">ACS_VLINE</tt></td></tr>
199 <tr><td class="left" valign="baseline"><var>ts</var></td>
200 <td class="left" >Top</td>
201 <td class="left" ><tt class="constant">ACS_HLINE</tt></td></tr>
202 <tr><td class="left" valign="baseline"><var>bs</var></td>
203 <td class="left" >Bottom</td>
204 <td class="left" ><tt class="constant">ACS_HLINE</tt></td></tr>
205 <tr><td class="left" valign="baseline"><var>tl</var></td>
206 <td class="left" >Upper-left corner</td>
207 <td class="left" ><tt class="constant">ACS_ULCORNER</tt></td></tr>
208 <tr><td class="left" valign="baseline"><var>tr</var></td>
209 <td class="left" >Upper-right corner</td>
210 <td class="left" ><tt class="constant">ACS_URCORNER</tt></td></tr>
211 <tr><td class="left" valign="baseline"><var>bl</var></td>
212 <td class="left" >Bottom-left corner</td>
213 <td class="left" ><tt class="constant">ACS_LLCORNER</tt></td></tr>
214 <tr><td class="left" valign="baseline"><var>br</var></td>
215 <td class="left" >Bottom-right corner</td>
216 <td class="left" ><tt class="constant">ACS_LRCORNER</tt></td></tr></tbody>
217</table></div>
218</dl>
219
220<P>
221<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
222 <td><nobr><b><tt id='l2h-2081' xml:id='l2h-2081' class="method">box</tt></b>(</nobr></td>
223 <td><var></var><big>[</big><var>vertch, horch</var><big>]</big><var></var>)</td></tr></table></dt>
224<dd>
225Similar to <tt class="method">border()</tt>, but both <var>ls</var> and <var>rs</var> are
226<var>vertch</var> and both <var>ts</var> and bs are <var>horch</var>. The default
227corner characters are always used by this function.
228</dl>
229
230<P>
231<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
232 <td><nobr><b><tt id='l2h-2082' xml:id='l2h-2082' class="method">clear</tt></b>(</nobr></td>
233 <td><var></var>)</td></tr></table></dt>
234<dd>
235Like <tt class="method">erase()</tt>, but also causes the whole window to be repainted
236upon next call to <tt class="method">refresh()</tt>.
237</dl>
238
239<P>
240<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
241 <td><nobr><b><tt id='l2h-2083' xml:id='l2h-2083' class="method">clearok</tt></b>(</nobr></td>
242 <td><var>yes</var>)</td></tr></table></dt>
243<dd>
244If <var>yes</var> is 1, the next call to <tt class="method">refresh()</tt>
245will clear the window completely.
246</dl>
247
248<P>
249<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
250 <td><nobr><b><tt id='l2h-2084' xml:id='l2h-2084' class="method">clrtobot</tt></b>(</nobr></td>
251 <td><var></var>)</td></tr></table></dt>
252<dd>
253Erase from cursor to the end of the window: all lines below the cursor
254are deleted, and then the equivalent of <tt class="method">clrtoeol()</tt> is performed.
255</dl>
256
257<P>
258<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
259 <td><nobr><b><tt id='l2h-2085' xml:id='l2h-2085' class="method">clrtoeol</tt></b>(</nobr></td>
260 <td><var></var>)</td></tr></table></dt>
261<dd>
262Erase from cursor to the end of the line.
263</dl>
264
265<P>
266<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
267 <td><nobr><b><tt id='l2h-2086' xml:id='l2h-2086' class="method">cursyncup</tt></b>(</nobr></td>
268 <td><var></var>)</td></tr></table></dt>
269<dd>
270Updates the current cursor position of all the ancestors of the window
271to reflect the current cursor position of the window.
272</dl>
273
274<P>
275<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
276 <td><nobr><b><tt id='l2h-2087' xml:id='l2h-2087' class="method">delch</tt></b>(</nobr></td>
277 <td><var></var><big>[</big><var>y, x</var><big>]</big><var></var>)</td></tr></table></dt>
278<dd>
279Delete any character at <code>(<var>y</var>, <var>x</var>)</code>.
280</dl>
281
282<P>
283<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
284 <td><nobr><b><tt id='l2h-2088' xml:id='l2h-2088' class="method">deleteln</tt></b>(</nobr></td>
285 <td><var></var>)</td></tr></table></dt>
286<dd>
287Delete the line under the cursor. All following lines are moved up
288by 1 line.
289</dl>
290
291<P>
292<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
293 <td><nobr><b><tt id='l2h-2089' xml:id='l2h-2089' class="method">derwin</tt></b>(</nobr></td>
294 <td><var></var><big>[</big><var>nlines, ncols,</var><big>]</big><var> begin_y, begin_x</var>)</td></tr></table></dt>
295<dd>
296An abbreviation for ``derive window'', <tt class="method">derwin()</tt> is the same
297as calling <tt class="method">subwin()</tt>, except that <var>begin_y</var> and
298<var>begin_x</var> are relative to the origin of the window, rather than
299relative to the entire screen. Returns a window object for the
300derived window.
301</dl>
302
303<P>
304<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
305 <td><nobr><b><tt id='l2h-2090' xml:id='l2h-2090' class="method">echochar</tt></b>(</nobr></td>
306 <td><var>ch</var><big>[</big><var>, attr</var><big>]</big><var></var>)</td></tr></table></dt>
307<dd>
308Add character <var>ch</var> with attribute <var>attr</var>, and immediately
309call <tt class="method">refresh()</tt> on the window.
310</dl>
311
312<P>
313<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
314 <td><nobr><b><tt id='l2h-2091' xml:id='l2h-2091' class="method">enclose</tt></b>(</nobr></td>
315 <td><var>y, x</var>)</td></tr></table></dt>
316<dd>
317Tests whether the given pair of screen-relative character-cell
318coordinates are enclosed by the given window, returning true or
319false. It is useful for determining what subset of the screen
320windows enclose the location of a mouse event.
321</dl>
322
323<P>
324<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
325 <td><nobr><b><tt id='l2h-2092' xml:id='l2h-2092' class="method">erase</tt></b>(</nobr></td>
326 <td><var></var>)</td></tr></table></dt>
327<dd>
328Clear the window.
329</dl>
330
331<P>
332<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
333 <td><nobr><b><tt id='l2h-2093' xml:id='l2h-2093' class="method">getbegyx</tt></b>(</nobr></td>
334 <td><var></var>)</td></tr></table></dt>
335<dd>
336Return a tuple <code>(<var>y</var>, <var>x</var>)</code> of co-ordinates of upper-left
337corner.
338</dl>
339
340<P>
341<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
342 <td><nobr><b><tt id='l2h-2094' xml:id='l2h-2094' class="method">getch</tt></b>(</nobr></td>
343 <td><var></var><big>[</big><var>y, x</var><big>]</big><var></var>)</td></tr></table></dt>
344<dd>
345Get a character. Note that the integer returned does <em>not</em> have to
346be in ASCII range: function keys, keypad keys and so on return numbers
347higher than 256. In no-delay mode, -1 is returned if there is
348no input.
349</dl>
350
351<P>
352<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
353 <td><nobr><b><tt id='l2h-2095' xml:id='l2h-2095' class="method">getkey</tt></b>(</nobr></td>
354 <td><var></var><big>[</big><var>y, x</var><big>]</big><var></var>)</td></tr></table></dt>
355<dd>
356Get a character, returning a string instead of an integer, as
357<tt class="method">getch()</tt> does. Function keys, keypad keys and so on return a
358multibyte string containing the key name. In no-delay mode, an
359exception is raised if there is no input.
360</dl>
361
362<P>
363<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
364 <td><nobr><b><tt id='l2h-2096' xml:id='l2h-2096' class="method">getmaxyx</tt></b>(</nobr></td>
365 <td><var></var>)</td></tr></table></dt>
366<dd>
367Return a tuple <code>(<var>y</var>, <var>x</var>)</code> of the height and width of
368the window.
369</dl>
370
371<P>
372<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
373 <td><nobr><b><tt id='l2h-2097' xml:id='l2h-2097' class="method">getparyx</tt></b>(</nobr></td>
374 <td><var></var>)</td></tr></table></dt>
375<dd>
376Returns the beginning coordinates of this window relative to its
377parent window into two integer variables y and x. Returns
378<code>-1,-1</code> if this window has no parent.
379</dl>
380
381<P>
382<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
383 <td><nobr><b><tt id='l2h-2098' xml:id='l2h-2098' class="method">getstr</tt></b>(</nobr></td>
384 <td><var></var><big>[</big><var>y, x</var><big>]</big><var></var>)</td></tr></table></dt>
385<dd>
386Read a string from the user, with primitive line editing capacity.
387</dl>
388
389<P>
390<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
391 <td><nobr><b><tt id='l2h-2099' xml:id='l2h-2099' class="method">getyx</tt></b>(</nobr></td>
392 <td><var></var>)</td></tr></table></dt>
393<dd>
394Return a tuple <code>(<var>y</var>, <var>x</var>)</code> of current cursor position
395relative to the window's upper-left corner.
396</dl>
397
398<P>
399<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
400 <td><nobr><b><tt id='l2h-2100' xml:id='l2h-2100' class="method">hline</tt></b>(</nobr></td>
401 <td><var></var><big>[</big><var>y, x,</var><big>]</big><var> ch, n</var>)</td></tr></table></dt>
402<dd>
403Display a horizontal line starting at <code>(<var>y</var>, <var>x</var>)</code> with
404length <var>n</var> consisting of the character <var>ch</var>.
405</dl>
406
407<P>
408<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
409 <td><nobr><b><tt id='l2h-2101' xml:id='l2h-2101' class="method">idcok</tt></b>(</nobr></td>
410 <td><var>flag</var>)</td></tr></table></dt>
411<dd>
412If <var>flag</var> is false, curses no longer considers using the hardware
413insert/delete character feature of the terminal; if <var>flag</var> is
414true, use of character insertion and deletion is enabled. When curses
415is first initialized, use of character insert/delete is enabled by
416default.
417</dl>
418
419<P>
420<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
421 <td><nobr><b><tt id='l2h-2102' xml:id='l2h-2102' class="method">idlok</tt></b>(</nobr></td>
422 <td><var>yes</var>)</td></tr></table></dt>
423<dd>
424If called with <var>yes</var> equal to 1, <tt class="module">curses</tt> will try and use
425hardware line editing facilities. Otherwise, line insertion/deletion
426are disabled.
427</dl>
428
429<P>
430<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
431 <td><nobr><b><tt id='l2h-2103' xml:id='l2h-2103' class="method">immedok</tt></b>(</nobr></td>
432 <td><var>flag</var>)</td></tr></table></dt>
433<dd>
434If <var>flag</var> is true, any change in the window image
435automatically causes the window to be refreshed; you no longer
436have to call <tt class="method">refresh()</tt> yourself. However, it may
437degrade performance considerably, due to repeated calls to
438wrefresh. This option is disabled by default.
439</dl>
440
441<P>
442<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
443 <td><nobr><b><tt id='l2h-2104' xml:id='l2h-2104' class="method">inch</tt></b>(</nobr></td>
444 <td><var></var><big>[</big><var>y, x</var><big>]</big><var></var>)</td></tr></table></dt>
445<dd>
446Return the character at the given position in the window. The bottom
4478 bits are the character proper, and upper bits are the attributes.
448</dl>
449
450<P>
451<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
452 <td><nobr><b><tt id='l2h-2105' xml:id='l2h-2105' class="method">insch</tt></b>(</nobr></td>
453 <td><var></var><big>[</big><var>y, x,</var><big>]</big><var> ch</var><big>[</big><var>, attr</var><big>]</big><var></var>)</td></tr></table></dt>
454<dd>
455Paint character <var>ch</var> at <code>(<var>y</var>, <var>x</var>)</code> with attributes
456<var>attr</var>, moving the line from position <var>x</var> right by one
457character.
458</dl>
459
460<P>
461<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
462 <td><nobr><b><tt id='l2h-2106' xml:id='l2h-2106' class="method">insdelln</tt></b>(</nobr></td>
463 <td><var>nlines</var>)</td></tr></table></dt>
464<dd>
465Inserts <var>nlines</var> lines into the specified window above the current
466line. The <var>nlines</var> bottom lines are lost. For negative
467<var>nlines</var>, delete <var>nlines</var> lines starting with the one under
468the cursor, and move the remaining lines up. The bottom <var>nlines</var>
469lines are cleared. The current cursor position remains the same.
470</dl>
471
472<P>
473<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
474 <td><nobr><b><tt id='l2h-2107' xml:id='l2h-2107' class="method">insertln</tt></b>(</nobr></td>
475 <td><var></var>)</td></tr></table></dt>
476<dd>
477Insert a blank line under the cursor. All following lines are moved
478down by 1 line.
479</dl>
480
481<P>
482<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
483 <td><nobr><b><tt id='l2h-2108' xml:id='l2h-2108' class="method">insnstr</tt></b>(</nobr></td>
484 <td><var></var><big>[</big><var>y, x,</var><big>]</big><var> str, n </var><big>[</big><var>, attr</var><big>]</big><var></var>)</td></tr></table></dt>
485<dd>
486Insert a character string (as many characters as will fit on the line)
487before the character under the cursor, up to <var>n</var> characters.
488If <var>n</var> is zero or negative,
489the entire string is inserted.
490All characters to the right of
491the cursor are shifted right, with the rightmost characters on the
492line being lost. The cursor position does not change (after moving to
493<var>y</var>, <var>x</var>, if specified).
494</dl>
495
496<P>
497<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
498 <td><nobr><b><tt id='l2h-2109' xml:id='l2h-2109' class="method">insstr</tt></b>(</nobr></td>
499 <td><var></var><big>[</big><var>y, x, </var><big>]</big><var> str </var><big>[</big><var>, attr</var><big>]</big><var></var>)</td></tr></table></dt>
500<dd>
501Insert a character string (as many characters as will fit on the line)
502before the character under the cursor. All characters to the right of
503the cursor are shifted right, with the rightmost characters on the
504line being lost. The cursor position does not change (after moving to
505<var>y</var>, <var>x</var>, if specified).
506</dl>
507
508<P>
509<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
510 <td><nobr><b><tt id='l2h-2110' xml:id='l2h-2110' class="method">instr</tt></b>(</nobr></td>
511 <td><var></var><big>[</big><var>y, x</var><big>]</big><var> </var><big>[</big><var>, n</var><big>]</big><var></var>)</td></tr></table></dt>
512<dd>
513Returns a string of characters, extracted from the window starting at
514the current cursor position, or at <var>y</var>, <var>x</var> if specified.
515Attributes are stripped from the characters. If <var>n</var> is specified,
516<tt class="method">instr()</tt> returns return a string at most <var>n</var> characters
517long (exclusive of the trailing NUL).
518</dl>
519
520<P>
521<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
522 <td><nobr><b><tt id='l2h-2111' xml:id='l2h-2111' class="method">is_linetouched</tt></b>(</nobr></td>
523 <td><var><var>line</var></var>)</td></tr></table></dt>
524<dd>
525Returns true if the specified line was modified since the last call to
526<tt class="method">refresh()</tt>; otherwise returns false. Raises a
527<tt class="exception">curses.error</tt> exception if <var>line</var> is not valid
528for the given window.
529</dl>
530
531<P>
532<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
533 <td><nobr><b><tt id='l2h-2112' xml:id='l2h-2112' class="method">is_wintouched</tt></b>(</nobr></td>
534 <td><var></var>)</td></tr></table></dt>
535<dd>
536Returns true if the specified window was modified since the last call to
537<tt class="method">refresh()</tt>; otherwise returns false.
538</dl>
539
540<P>
541<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
542 <td><nobr><b><tt id='l2h-2113' xml:id='l2h-2113' class="method">keypad</tt></b>(</nobr></td>
543 <td><var>yes</var>)</td></tr></table></dt>
544<dd>
545If <var>yes</var> is 1, escape sequences generated by some keys (keypad,
546function keys) will be interpreted by <tt class="module">curses</tt>.
547If <var>yes</var> is 0, escape sequences will be left as is in the input
548stream.
549</dl>
550
551<P>
552<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
553 <td><nobr><b><tt id='l2h-2114' xml:id='l2h-2114' class="method">leaveok</tt></b>(</nobr></td>
554 <td><var>yes</var>)</td></tr></table></dt>
555<dd>
556If <var>yes</var> is 1, cursor is left where it is on update, instead of
557being at ``cursor position.'' This reduces cursor movement where
558possible. If possible the cursor will be made invisible.
559
560<P>
561If <var>yes</var> is 0, cursor will always be at ``cursor position'' after
562an update.
563</dl>
564
565<P>
566<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
567 <td><nobr><b><tt id='l2h-2115' xml:id='l2h-2115' class="method">move</tt></b>(</nobr></td>
568 <td><var>new_y, new_x</var>)</td></tr></table></dt>
569<dd>
570Move cursor to <code>(<var>new_y</var>, <var>new_x</var>)</code>.
571</dl>
572
573<P>
574<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
575 <td><nobr><b><tt id='l2h-2116' xml:id='l2h-2116' class="method">mvderwin</tt></b>(</nobr></td>
576 <td><var>y, x</var>)</td></tr></table></dt>
577<dd>
578Moves the window inside its parent window. The screen-relative
579parameters of the window are not changed. This routine is used to
580display different parts of the parent window at the same physical
581position on the screen.
582</dl>
583
584<P>
585<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
586 <td><nobr><b><tt id='l2h-2117' xml:id='l2h-2117' class="method">mvwin</tt></b>(</nobr></td>
587 <td><var>new_y, new_x</var>)</td></tr></table></dt>
588<dd>
589Move the window so its upper-left corner is at
590<code>(<var>new_y</var>, <var>new_x</var>)</code>.
591</dl>
592
593<P>
594<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
595 <td><nobr><b><tt id='l2h-2118' xml:id='l2h-2118' class="method">nodelay</tt></b>(</nobr></td>
596 <td><var>yes</var>)</td></tr></table></dt>
597<dd>
598If <var>yes</var> is <code>1</code>, <tt class="method">getch()</tt> will be non-blocking.
599</dl>
600
601<P>
602<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
603 <td><nobr><b><tt id='l2h-2119' xml:id='l2h-2119' class="method">notimeout</tt></b>(</nobr></td>
604 <td><var>yes</var>)</td></tr></table></dt>
605<dd>
606If <var>yes</var> is <code>1</code>, escape sequences will not be timed out.
607
608<P>
609If <var>yes</var> is <code>0</code>, after a few milliseconds, an escape sequence
610will not be interpreted, and will be left in the input stream as is.
611</dl>
612
613<P>
614<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
615 <td><nobr><b><tt id='l2h-2120' xml:id='l2h-2120' class="method">noutrefresh</tt></b>(</nobr></td>
616 <td><var></var>)</td></tr></table></dt>
617<dd>
618Mark for refresh but wait. This function updates the data structure
619representing the desired state of the window, but does not force
620an update of the physical screen. To accomplish that, call
621<tt class="function">doupdate()</tt>.
622</dl>
623
624<P>
625<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
626 <td><nobr><b><tt id='l2h-2121' xml:id='l2h-2121' class="method">overlay</tt></b>(</nobr></td>
627 <td><var>destwin</var><big>[</big><var>, sminrow, smincol,
628 dminrow, dmincol, dmaxrow, dmaxcol</var><big>]</big><var></var>)</td></tr></table></dt>
629<dd>
630Overlay the window on top of <var>destwin</var>. The windows need not be
631the same size, only the overlapping region is copied. This copy is
632non-destructive, which means that the current background character
633does not overwrite the old contents of <var>destwin</var>.
634
635<P>
636To get fine-grained control over the copied region, the second form
637of <tt class="method">overlay()</tt> can be used. <var>sminrow</var> and <var>smincol</var> are
638the upper-left coordinates of the source window, and the other variables
639mark a rectangle in the destination window.
640</dl>
641
642<P>
643<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
644 <td><nobr><b><tt id='l2h-2122' xml:id='l2h-2122' class="method">overwrite</tt></b>(</nobr></td>
645 <td><var>destwin</var><big>[</big><var>, sminrow, smincol,
646 dminrow, dmincol, dmaxrow, dmaxcol</var><big>]</big><var></var>)</td></tr></table></dt>
647<dd>
648Overwrite the window on top of <var>destwin</var>. The windows need not be
649the same size, in which case only the overlapping region is
650copied. This copy is destructive, which means that the current
651background character overwrites the old contents of <var>destwin</var>.
652
653<P>
654To get fine-grained control over the copied region, the second form
655of <tt class="method">overwrite()</tt> can be used. <var>sminrow</var> and <var>smincol</var> are
656the upper-left coordinates of the source window, the other variables
657mark a rectangle in the destination window.
658</dl>
659
660<P>
661<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
662 <td><nobr><b><tt id='l2h-2123' xml:id='l2h-2123' class="method">putwin</tt></b>(</nobr></td>
663 <td><var>file</var>)</td></tr></table></dt>
664<dd>
665Writes all data associated with the window into the provided file
666object. This information can be later retrieved using the
667<tt class="function">getwin()</tt> function.
668</dl>
669
670<P>
671<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
672 <td><nobr><b><tt id='l2h-2124' xml:id='l2h-2124' class="method">redrawln</tt></b>(</nobr></td>
673 <td><var>beg, num</var>)</td></tr></table></dt>
674<dd>
675Indicates that the <var>num</var> screen lines, starting at line <var>beg</var>,
676are corrupted and should be completely redrawn on the next
677<tt class="method">refresh()</tt> call.
678</dl>
679
680<P>
681<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
682 <td><nobr><b><tt id='l2h-2125' xml:id='l2h-2125' class="method">redrawwin</tt></b>(</nobr></td>
683 <td><var></var>)</td></tr></table></dt>
684<dd>
685Touches the entire window, causing it to be completely redrawn on the
686next <tt class="method">refresh()</tt> call.
687</dl>
688
689<P>
690<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
691 <td><nobr><b><tt id='l2h-2126' xml:id='l2h-2126' class="method">refresh</tt></b>(</nobr></td>
692 <td><var></var><big>[</big><var>pminrow, pmincol, sminrow,
693 smincol, smaxrow, smaxcol</var><big>]</big><var></var>)</td></tr></table></dt>
694<dd>
695Update the display immediately (sync actual screen with previous
696drawing/deleting methods).
697
698<P>
699The 6 optional arguments can only be specified when the window is a
700pad created with <tt class="function">newpad()</tt>. The additional parameters are
701needed to indicate what part of the pad and screen are involved.
702<var>pminrow</var> and <var>pmincol</var> specify the upper left-hand corner of the
703rectangle to be displayed in the pad. <var>sminrow</var>, <var>smincol</var>,
704<var>smaxrow</var>, and <var>smaxcol</var> specify the edges of the rectangle to
705be displayed on the screen. The lower right-hand corner of the
706rectangle to be displayed in the pad is calculated from the screen
707coordinates, since the rectangles must be the same size. Both
708rectangles must be entirely contained within their respective
709structures. Negative values of <var>pminrow</var>, <var>pmincol</var>,
710<var>sminrow</var>, or <var>smincol</var> are treated as if they were zero.
711</dl>
712
713<P>
714<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
715 <td><nobr><b><tt id='l2h-2127' xml:id='l2h-2127' class="method">scroll</tt></b>(</nobr></td>
716 <td><var></var><big>[</big><var>lines<code> = 1</code></var><big>]</big><var></var>)</td></tr></table></dt>
717<dd>
718Scroll the screen or scrolling region upward by <var>lines</var> lines.
719</dl>
720
721<P>
722<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
723 <td><nobr><b><tt id='l2h-2128' xml:id='l2h-2128' class="method">scrollok</tt></b>(</nobr></td>
724 <td><var>flag</var>)</td></tr></table></dt>
725<dd>
726Controls what happens when the cursor of a window is moved off the
727edge of the window or scrolling region, either as a result of a
728newline action on the bottom line, or typing the last character
729of the last line. If <var>flag</var> is false, the cursor is left
730on the bottom line. If <var>flag</var> is true, the window is
731scrolled up one line. Note that in order to get the physical
732scrolling effect on the terminal, it is also necessary to call
733<tt class="method">idlok()</tt>.
734</dl>
735
736<P>
737<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
738 <td><nobr><b><tt id='l2h-2129' xml:id='l2h-2129' class="method">setscrreg</tt></b>(</nobr></td>
739 <td><var>top, bottom</var>)</td></tr></table></dt>
740<dd>
741Set the scrolling region from line <var>top</var> to line <var>bottom</var>. All
742scrolling actions will take place in this region.
743</dl>
744
745<P>
746<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
747 <td><nobr><b><tt id='l2h-2130' xml:id='l2h-2130' class="method">standend</tt></b>(</nobr></td>
748 <td><var></var>)</td></tr></table></dt>
749<dd>
750Turn off the standout attribute. On some terminals this has the
751side effect of turning off all attributes.
752</dl>
753
754<P>
755<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
756 <td><nobr><b><tt id='l2h-2131' xml:id='l2h-2131' class="method">standout</tt></b>(</nobr></td>
757 <td><var></var>)</td></tr></table></dt>
758<dd>
759Turn on attribute <var>A_STANDOUT</var>.
760</dl>
761
762<P>
763<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
764 <td><nobr><b><tt id='l2h-2132' xml:id='l2h-2132' class="method">subpad</tt></b>(</nobr></td>
765 <td><var></var><big>[</big><var>nlines, ncols,</var><big>]</big><var> begin_y, begin_x</var>)</td></tr></table></dt>
766<dd>
767Return a sub-window, whose upper-left corner is at
768<code>(<var>begin_y</var>, <var>begin_x</var>)</code>, and whose width/height is
769<var>ncols</var>/<var>nlines</var>.
770</dl>
771
772<P>
773<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
774 <td><nobr><b><tt id='l2h-2133' xml:id='l2h-2133' class="method">subwin</tt></b>(</nobr></td>
775 <td><var></var><big>[</big><var>nlines, ncols,</var><big>]</big><var> begin_y, begin_x</var>)</td></tr></table></dt>
776<dd>
777Return a sub-window, whose upper-left corner is at
778<code>(<var>begin_y</var>, <var>begin_x</var>)</code>, and whose width/height is
779<var>ncols</var>/<var>nlines</var>.
780
781<P>
782By default, the sub-window will extend from the
783specified position to the lower right corner of the window.
784</dl>
785
786<P>
787<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
788 <td><nobr><b><tt id='l2h-2134' xml:id='l2h-2134' class="method">syncdown</tt></b>(</nobr></td>
789 <td><var></var>)</td></tr></table></dt>
790<dd>
791Touches each location in the window that has been touched in any of
792its ancestor windows. This routine is called by <tt class="method">refresh()</tt>,
793so it should almost never be necessary to call it manually.
794</dl>
795
796<P>
797<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
798 <td><nobr><b><tt id='l2h-2135' xml:id='l2h-2135' class="method">syncok</tt></b>(</nobr></td>
799 <td><var>flag</var>)</td></tr></table></dt>
800<dd>
801If called with <var>flag</var> set to true, then <tt class="method">syncup()</tt> is
802called automatically whenever there is a change in the window.
803</dl>
804
805<P>
806<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
807 <td><nobr><b><tt id='l2h-2136' xml:id='l2h-2136' class="method">syncup</tt></b>(</nobr></td>
808 <td><var></var>)</td></tr></table></dt>
809<dd>
810Touches all locations in ancestors of the window that have been changed in
811the window.
812</dl>
813
814<P>
815<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
816 <td><nobr><b><tt id='l2h-2137' xml:id='l2h-2137' class="method">timeout</tt></b>(</nobr></td>
817 <td><var>delay</var>)</td></tr></table></dt>
818<dd>
819Sets blocking or non-blocking read behavior for the window. If
820<var>delay</var> is negative, blocking read is used (which will wait
821indefinitely for input). If <var>delay</var> is zero, then non-blocking
822read is used, and -1 will be returned by <tt class="method">getch()</tt> if no input
823is waiting. If <var>delay</var> is positive, then <tt class="method">getch()</tt> will
824block for <var>delay</var> milliseconds, and return -1 if there is still no
825input at the end of that time.
826</dl>
827
828<P>
829<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
830 <td><nobr><b><tt id='l2h-2138' xml:id='l2h-2138' class="method">touchline</tt></b>(</nobr></td>
831 <td><var>start, count</var>)</td></tr></table></dt>
832<dd>
833Pretend <var>count</var> lines have been changed, starting with line
834<var>start</var>.
835</dl>
836
837<P>
838<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
839 <td><nobr><b><tt id='l2h-2139' xml:id='l2h-2139' class="method">touchwin</tt></b>(</nobr></td>
840 <td><var></var>)</td></tr></table></dt>
841<dd>
842Pretend the whole window has been changed, for purposes of drawing
843optimizations.
844</dl>
845
846<P>
847<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
848 <td><nobr><b><tt id='l2h-2140' xml:id='l2h-2140' class="method">untouchwin</tt></b>(</nobr></td>
849 <td><var></var>)</td></tr></table></dt>
850<dd>
851Marks all lines in the window as unchanged since the last call to
852<tt class="method">refresh()</tt>.
853</dl>
854
855<P>
856<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
857 <td><nobr><b><tt id='l2h-2141' xml:id='l2h-2141' class="method">vline</tt></b>(</nobr></td>
858 <td><var></var><big>[</big><var>y, x,</var><big>]</big><var> ch, n</var>)</td></tr></table></dt>
859<dd>
860Display a vertical line starting at <code>(<var>y</var>, <var>x</var>)</code> with
861length <var>n</var> consisting of the character <var>ch</var>.
862</dl>
863
864<P>
865
866<DIV CLASS="navigation">
867<div class='online-navigation'>
868<p></p><hr />
869<table align="center" width="100%" cellpadding="0" cellspacing="2">
870<tr>
871<td class='online-navigation'><a rel="prev" title="6.15.1 Functions"
872 href="curses-functions.html"><img src='../icons/previous.png'
873 border='0' height='32' alt='Previous Page' width='32' /></A></td>
874<td class='online-navigation'><a rel="parent" title="6.15 curses "
875 href="module-curses.html"><img src='../icons/up.png'
876 border='0' height='32' alt='Up One Level' width='32' /></A></td>
877<td class='online-navigation'><a rel="next" title="6.15.3 Constants"
878 href="node267.html"><img src='../icons/next.png'
879 border='0' height='32' alt='Next Page' width='32' /></A></td>
880<td align="center" width="100%">Python Library Reference</td>
881<td class='online-navigation'><a rel="contents" title="Table of Contents"
882 href="contents.html"><img src='../icons/contents.png'
883 border='0' height='32' alt='Contents' width='32' /></A></td>
884<td class='online-navigation'><a href="modindex.html" title="Module Index"><img src='../icons/modules.png'
885 border='0' height='32' alt='Module Index' width='32' /></a></td>
886<td class='online-navigation'><a rel="index" title="Index"
887 href="genindex.html"><img src='../icons/index.png'
888 border='0' height='32' alt='Index' width='32' /></A></td>
889</tr></table>
890<div class='online-navigation'>
891<b class="navlabel">Previous:</b>
892<a class="sectref" rel="prev" href="curses-functions.html">6.15.1 Functions</A>
893<b class="navlabel">Up:</b>
894<a class="sectref" rel="parent" href="module-curses.html">6.15 curses </A>
895<b class="navlabel">Next:</b>
896<a class="sectref" rel="next" href="node267.html">6.15.3 Constants</A>
897</div>
898</div>
899<hr />
900<span class="release-info">Release 2.4.2, documentation updated on 28 September 2005.</span>
901</DIV>
902<!--End of Navigation Panel-->
903<ADDRESS>
904See <i><a href="about.html">About this document...</a></i> for information on suggesting changes.
905</ADDRESS>
906</BODY>
907</HTML>