📄 curses-window-objects.html
字号:
<dd>
If <var>flag</var> is true, any change in the window image
automatically causes the window to be refreshed; you no longer
have to call <tt class="method">refresh()</tt> yourself. However, it may
degrade performance considerably, due to repeated calls to
wrefresh. This option is disabled by default.
</dl>
<P>
<dl><dt><b><a name='l2h-1268'><tt class='method'>inch</tt></a></b> (<big>[</big><var>x, y</var><big>]</big>)
<dd>
Return the character at the given position in the window. The bottom
8 bits are the character proper, and upper bits are the attributes.
</dl>
<P>
<dl><dt><b><a name='l2h-1269'><tt class='method'>insch</tt></a></b> (<big>[</big><var>y, x,</var><big>]</big><var> ch</var><big>[</big><var>, attr</var><big>]</big>)
<dd>
Paint character <var>ch</var> at <code>(<var>y</var>, <var>x</var>)</code> with attributes
<var>attr</var>, moving the line from position <var>x</var> right by one
character.
</dl>
<P>
<dl><dt><b><a name='l2h-1270'><tt class='method'>insdelln</tt></a></b> (<var>nlines</var>)
<dd>
Inserts <var>nlines</var> lines into the specified window above the current
line. The <var>nlines</var> bottom lines are lost. For negative
<var>nlines</var>, delete <var>nlines</var> lines starting with the one under
the cursor, and move the remaining lines up. The bottom <var>nlines</var>
lines are cleared. The current cursor position remains the same.
</dl>
<P>
<dl><dt><b><a name='l2h-1271'><tt class='method'>insertln</tt></a></b> ()
<dd>
Insert a blank line under the cursor. All following lines are moved
down by 1 line.
</dl>
<P>
<dl><dt><b><a name='l2h-1272'><tt class='method'>insnstr</tt></a></b> (<big>[</big><var>y, x, </var><big>]</big><var> str, n </var><big>[</big><var>, attr</var><big>]</big>)
<dd>
Insert a character string (as many characters as will fit on the line)
before the character under the cursor, up to <var>n</var> characters.
If <var>n</var> is zero or negative,
the entire string is inserted.
All characters to the right of
the cursor are shifted right, with the the rightmost characters on the
line being lost. The cursor position does not change (after moving to
<var>y</var>, <var>x</var>, if specified).
</dl>
<P>
<dl><dt><b><a name='l2h-1273'><tt class='method'>insstr</tt></a></b> (<big>[</big><var>y, x, </var><big>]</big><var> str </var><big>[</big><var>, attr</var><big>]</big>)
<dd>
Insert a character string (as many characters as will fit on the line)
before the character under the cursor. All characters to the right of
the cursor are shifted right, with the the rightmost characters on the
line being lost. The cursor position does not change (after moving to
<var>y</var>, <var>x</var>, if specified).
</dl>
<P>
<dl><dt><b><a name='l2h-1274'><tt class='method'>instr</tt></a></b> (<big>[</big><var>y, x</var><big>]</big><big>[</big><var>, n</var><big>]</big>)
<dd>
Returns a string of characters, extracted from the window starting at
the current cursor position, or at <var>y</var>, <var>x</var> if specified.
Attributes are stripped from the characters. If <var>n</var> is specified,
<tt class="method">instr()</tt> returns return a string at most <var>n</var> characters
long (exclusive of the trailing NUL).
</dl>
<P>
<dl><dt><b><a name='l2h-1275'><tt class='method'>is_linetouched</tt></a></b> (<var><var>line</var></var>)
<dd>
Returns true if the specified line was modified since the last call to
<tt class="method">refresh()</tt>; otherwise returns false. Raises a
<tt class="exception">curses.error</tt> exception if <var>line</var> is not valid
for the given window.
</dl>
<P>
<dl><dt><b><a name='l2h-1276'><tt class='method'>is_wintouched</tt></a></b> ()
<dd>
Returns true if the specified window was modified since the last call to
<tt class="method">refresh()</tt>; otherwise returns false.
</dl>
<P>
<dl><dt><b><a name='l2h-1277'><tt class='method'>keypad</tt></a></b> (<var>yes</var>)
<dd>
If <var>yes</var> is 1, escape sequences generated by some keys (keypad,
function keys) will be interpreted by <tt class="module">curses</tt>.
If <var>yes</var> is 0, escape sequences will be left as is in the input
stream.
</dl>
<P>
<dl><dt><b><a name='l2h-1278'><tt class='method'>leaveok</tt></a></b> (<var>yes</var>)
<dd>
If <var>yes</var> is 1, cursor is left where it is on update, instead of
being at ``cursor position.'' This reduces cursor movement where
possible. If possible the cursor will be made invisible.
<P>
If <var>yes</var> is 0, cursor will always be at ``cursor position'' after
an update.
</dl>
<P>
<dl><dt><b><a name='l2h-1279'><tt class='method'>move</tt></a></b> (<var>new_y, new_x</var>)
<dd>
Move cursor to <code>(<var>new_y</var>, <var>new_x</var>)</code>.
</dl>
<P>
<dl><dt><b><a name='l2h-1280'><tt class='method'>mvderwin</tt></a></b> (<var>y, x</var>)
<dd>
Moves the window inside its parent window. The screen-relative
parameters of the window are not changed. This routine is used to
display different parts of the parent window at the same physical
position on the screen.
</dl>
<P>
<dl><dt><b><a name='l2h-1281'><tt class='method'>mvwin</tt></a></b> (<var>new_y, new_x</var>)
<dd>
Move the window so its upper-left corner is at <code>(<var>new_y</var>, <var>new_x</var>)</code>.
</dl>
<P>
<dl><dt><b><a name='l2h-1282'><tt class='method'>nodelay</tt></a></b> (<var>yes</var>)
<dd>
If <var>yes</var> is 1, <tt class="method">getch()</tt> will be non-blocking.
</dl>
<P>
<dl><dt><b><a name='l2h-1283'><tt class='method'>notimeout</tt></a></b> (<var>yes</var>)
<dd>
If <var>yes</var> is 1, escape sequences will not be timed out.
<P>
If <var>yes</var> is 0, after a few milliseconds, an escape sequence will
not be interpreted, and will be left in the input stream as is.
</dl>
<P>
<dl><dt><b><a name='l2h-1284'><tt class='method'>noutrefresh</tt></a></b> ()
<dd>
Mark for refresh but wait. This function updates the data structure
representing the desired state of the window, but does not force
an update of the physical screen.
</dl>
<P>
<dl><dt><b><a name='l2h-1285'><tt class='method'>putwin</tt></a></b> (<var>file</var>)
<dd>
Writes all data associated with the window into the provided file
object. This information can be later retrieved using the
<tt class="function">getwin()</tt> function.
<P>
</dl>
<P>
<dl><dt><b><a name='l2h-1286'><tt class='method'>redrawln</tt></a></b> (<var>beg, num</var>)
<dd>
Indicates that the <var>num</var> screen lines, starting at line <var>beg</var>,
are corrupted and should be completely redrawn on the next
<tt class="method">refresh()</tt> call.
</dl>
<P>
<dl><dt><b><a name='l2h-1287'><tt class='method'>redrawwin</tt></a></b> ()
<dd>
Touches the entire window, causing it to be completely redrawn on the
next <tt class="method">refresh()</tt> call.
</dl>
<P>
<dl><dt><b><a name='l2h-1288'><tt class='method'>refresh</tt></a></b> (<big>[</big><var>pminrow, pmincol, sminrow, smincol, smaxrow, smaxcol</var><big>]</big>)
<dd>
Update the display immediately (sync actual screen with previous
drawing/deleting methods).
<P>
The 6 optional arguments can only be specified when the window is a
pad created with <tt class="function">newpad()</tt>. The additional parameters are
needed to indicate what part of the pad and screen are involved.
<var>pminrow</var> and <var>pmincol</var> specify the upper left-hand corner of the
rectangle to be displayed in the pad. <var>sminrow</var>, <var>smincol</var>,
<var>smaxrow</var>, and <var>smaxcol</var> specify the edges of the rectangle to be displayed on the screen. The lower right-hand corner of the
rectangle to be displayed in the pad is calculated from the screen
coordinates, since the rectangles must be the same size. Both
rectangles must be entirely contained within their respective
structures. Negative values of <var>pminrow</var>, <var>pmincol</var>,
<var>sminrow</var>, or <var>smincol</var> are treated as if they were zero.
</dl>
<P>
<dl><dt><b><a name='l2h-1289'><tt class='method'>scroll</tt></a></b> (<big>[</big><var>lines<code> = 1</code></var><big>]</big>)
<dd>
Scroll the screen upward by <var>lines</var> lines.
</dl>
<P>
<dl><dt><b><a name='l2h-1290'><tt class='method'>scrollok</tt></a></b> (<var>flag</var>)
<dd>
Controls what happens when the cursor of a window is moved off the
edge of the window or scrolling region, either as a result of a
newline action on the bottom line, or typing the last character
of the last line. If <var>flag</var> is false, the cursor is left
on the bottom line. If <var>flag</var> is true, the window is
scrolled up one line. Note that in order to get the physical
scrolling effect on the terminal, it is also necessary to call
<tt class="method">idlok()</tt>.
</dl>
<P>
<dl><dt><b><a name='l2h-1291'><tt class='method'>setscrreg</tt></a></b> (<var>top, bottom</var>)
<dd>
Set the scrolling region from line <var>top</var> to line <var>bottom</var>. All
scrolling actions will take place in this region.
</dl>
<P>
<dl><dt><b><a name='l2h-1292'><tt class='method'>standend</tt></a></b> ()
<dd>
Turn off the standout attribute. On some terminals this has the
side effect of turning off all attributes.
</dl>
<P>
<dl><dt><b><a name='l2h-1293'><tt class='method'>standout</tt></a></b> ()
<dd>
Turn on attribute <var>A_STANDOUT</var>.
</dl>
<P>
<dl><dt><b><a name='l2h-1294'><tt class='method'>subpad</tt></a></b> (<big>[</big><var>nlines, ncols,</var><big>]</big><var> begin_y, begin_y</var>)
<dd>
Return a sub-window, whose upper-left corner is at
<code>(<var>begin_y</var>, <var>begin_x</var>)</code>, and whose width/height is
<var>ncols</var>/<var>nlines</var>.
</dl>
<P>
<dl><dt><b><a name='l2h-1295'><tt class='method'>subwin</tt></a></b> (<big>[</big><var>nlines, ncols,</var><big>]</big><var> begin_y, begin_y</var>)
<dd>
Return a sub-window, whose upper-left corner is at
<code>(<var>begin_y</var>, <var>begin_x</var>)</code>, and whose width/height is
<var>ncols</var>/<var>nlines</var>.
<P>
By default, the sub-window will extend from the
specified position to the lower right corner of the window.
</dl>
<P>
<dl><dt><b><a name='l2h-1296'><tt class='method'>syncdown</tt></a></b> ()
<dd>
Touches each location in the window that has been touched in any of
its ancestor windows. This routine is called by <tt class="method">refresh()</tt>,
so it should almost never be necessary to call it manually.
</dl>
<P>
<dl><dt><b><a name='l2h-1297'><tt class='method'>syncok</tt></a></b> (<var>flag</var>)
<dd>
If called with <var>flag</var> set to true, then <tt class="method">syncup()</tt> is
called automatically whenever there is a change in the window.
</dl>
<P>
<dl><dt><b><a name='l2h-1298'><tt class='method'>syncup</tt></a></b> ()
<dd>
Touches all locations in ancestors of the window that have been changed in
the window.
</dl>
<P>
<dl><dt><b><a name='l2h-1299'><tt class='method'>timeout</tt></a></b> (<var>delay</var>)
<dd>
Sets blocking or non-blocking read behavior for the window. If
<var>delay</var> is negative, blocking read is used, which will wait
indefinitely for input). If <var>delay</var> is zero, then non-blocking
read is used, and -1 will be returned by <tt class="method">getch()</tt> if no input
is waiting. If <var>delay</var> is positive, then <tt class="method">getch()</tt> will
block for <var>delay</var> milliseconds, and return -1 if there is still no
input at the end of that time.
</dl>
<P>
<dl><dt><b><a name='l2h-1300'><tt class='method'>touchline</tt></a></b> (<var>start, count</var>)
<dd>
Pretend <var>count</var> lines have been changed, starting with line
<var>start</var>.
</dl>
<P>
<dl><dt><b><a name='l2h-1301'><tt class='method'>touchwin</tt></a></b> ()
<dd>
Pretend the whole window has been changed, for purposes of drawing
optimizations.
</dl>
<P>
<dl><dt><b><a name='l2h-1302'><tt class='method'>untouchwin</tt></a></b> ()
<dd>
Marks all lines in the window as unchanged since the last call to
<tt class="method">refresh()</tt>.
</dl>
<P>
<dl><dt><b><a name='l2h-1303'><tt class='method'>vline</tt></a></b> (<big>[</big><var>y, x,</var><big>]</big><var> ch, n</var>)
<dd>
Display a vertical line starting at <code>(<var>y</var>, <var>x</var>)</code> with
length <var>n</var> consisting of the character <var>ch</var>.
</dl>
<P>
<DIV CLASS="navigation"><p><hr><table align="center" width="100%" cellpadding="0" cellspacing="2">
<tr>
<td><A href="curses-functions.html" tppabs="http://www.python.org/doc/current/lib/curses-functions.html"><img src="previous.gif" tppabs="http://www.python.org/doc/current/icons/previous.gif" border="0" height="32"
alt="Previous Page" width="32"></A></td>
<td><A href="module-curses.html" tppabs="http://www.python.org/doc/current/lib/module-curses.html"><img src="up.gif" tppabs="http://www.python.org/doc/current/icons/up.gif" border="0" height="32"
alt="Up One Level" width="32"></A></td>
<td><A HREF="node128.html" tppabs="http://www.python.org/doc/current/lib/node128.html"><img src="next.gif" tppabs="http://www.python.org/doc/current/icons/next.gif" border="0" height="32"
alt="Next Page" width="32"></A></td>
<td align="center" width="100%">Python Library Reference</td>
<td><A href="contents.html" tppabs="http://www.python.org/doc/current/lib/contents.html"><img src="contents.gif" tppabs="http://www.python.org/doc/current/icons/contents.gif" border="0" height="32"
alt="Contents" width="32"></A></td>
<td><a href="modindex.html" tppabs="http://www.python.org/doc/current/lib/modindex.html" title="Module Index"><img src="modules.gif" tppabs="http://www.python.org/doc/current/icons/modules.gif" border="0" height="32"
alt="Module Index" width="32"></a></td>
<td><A href="genindex.html" tppabs="http://www.python.org/doc/current/lib/genindex.html"><img src="index.gif" tppabs="http://www.python.org/doc/current/icons/index.gif" border="0" height="32"
alt="Index" width="32"></A></td>
</tr></table>
<b class="navlabel">Previous:</b> <a class="sectref" href="curses-functions.html" tppabs="http://www.python.org/doc/current/lib/curses-functions.html">6.12.1 Functions</A>
<b class="navlabel">Up:</b> <a class="sectref" href="module-curses.html" tppabs="http://www.python.org/doc/current/lib/module-curses.html">6.12 curses </A>
<b class="navlabel">Next:</b> <a class="sectref" HREF="node128.html" tppabs="http://www.python.org/doc/current/lib/node128.html">6.12.3 Constants</A>
</DIV>
<!--End of Navigation Panel-->
<ADDRESS>
<hr>See <i><a href="about.html" tppabs="http://www.python.org/doc/current/lib/about.html">About this document...</a></i> for information on suggesting changes.
</ADDRESS>
</BODY>
</HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -