⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 curses-functions.html

📁 一本很好的python的说明书,适合对python感兴趣的人
💻 HTML
📖 第 1 页 / 共 2 页
字号:
<dd>
Return the name of the key numbered <var>k</var>.  The name of a key
generating printable ASCII character is the key's character.  The name
of a control-key combination is a two-character string consisting of a
caret followed by the corresponding printable ASCII character.  The
name of an alt-key combination (128-255) is a string consisting of the
prefix `M-' followed by the name of the corresponding ASCII character.
</dl>

<P>
<dl><dt><b><a name='l2h-1204'><tt class='function'>killchar</tt></a></b> ()
<dd>
Returns the user's current line kill character. Under Unix operating
systems this is a property of the controlling tty of the curses
program, and is not set by the curses library itself.
</dl>

<P>
<dl><dt><b><a name='l2h-1205'><tt class='function'>longname</tt></a></b> ()
<dd>
Returns a string containing the terminfo long name field describing the current
terminal.  The maximum length of a verbose description is 128
characters.  It is defined only after the call to
<tt class="function">initscr()</tt>.
</dl>

<P>
<dl><dt><b><a name='l2h-1206'><tt class='function'>meta</tt></a></b> (<var>yes</var>)
<dd>
If <var>yes</var> is 1, allow 8-bit characters to be input. If <var>yes</var> is 0, 
allow only 7-bit chars.
</dl>

<P>
<dl><dt><b><a name='l2h-1207'><tt class='function'>mouseinterval</tt></a></b> (<var>interval</var>)
<dd>
Sets the maximum time in milliseconds that can elapse between press and
release events in order for them to be recognized as a click, and
returns the previous interval value.  The default value is 200 msec,
or one fifth of a second.
</dl>

<P>
<dl><dt><b><a name='l2h-1208'><tt class='function'>mousemask</tt></a></b> (<var>mousemask</var>)
<dd>
Sets the mouse events to be reported, and returns a tuple
<code>(<var>availmask</var>, <var>oldmask</var>)</code>.  
<var>availmask</var> indicates which of the
specified mouse events can be reported; on complete failure it returns
0.  <var>oldmask</var> is the previous value of the given window's mouse
event mask.  If this function is never called, no mouse events are
ever reported.
</dl>

<P>
<dl><dt><b><a name='l2h-1209'><tt class='function'>newpad</tt></a></b> (<var>nlines, ncols</var>)
<dd>
Creates and returns a pointer to a new pad data structure with the
given number of lines and columns.  A pad is returned as a
window object.

<P>
A pad is like a window, except that it is not restricted by the screen
size, and is not necessarily associated with a particular part of the
screen.  Pads can be used when a large window is needed, and only a
part of the window will be on the screen at one time.  Automatic
refreshes of pads (e.g., from scrolling or echoing of input) do not
occur.  The <tt class="method">refresh()</tt> and <tt class="method">noutrefresh()</tt> methods of a
pad require 6 arguments to specify the part of the pad to be
displayed and the location on the screen to be used for the display.
The arguments are pminrow, pmincol, sminrow, smincol, smaxrow,
smaxcol; the p arguments refer to the upper left corner of the the pad
region to be displayed and the s arguments define a clipping box on
the screen within which the pad region is to be displayed.
</dl>

<P>
<dl><dt><b><a name='l2h-1210'><tt class='function'>newwin</tt></a></b> (<big>[</big><var>nlines, ncols,</var><big>]</big><var> begin_y, begin_x</var>)
<dd>
Return a new window, whose left-upper corner is at 
<code>(<var>begin_y</var>, <var>begin_x</var>)</code>, and whose height/width is 
<var>nlines</var>/<var>ncols</var>.  

<P>
By default, the window will extend from the 
specified position to the lower right corner of the screen.
</dl>

<P>
<dl><dt><b><a name='l2h-1211'><tt class='function'>nl</tt></a></b> ()
<dd>
Enter newline mode.  This mode translates the return key into newline
on input, and translates newline into return and line-feed on output.
Newline mode is initially on.
</dl>

<P>
<dl><dt><b><a name='l2h-1212'><tt class='function'>nocbreak</tt></a></b> ()
<dd>
Leave cbreak mode.  Return to normal ``cooked'' mode with line buffering.
</dl>

<P>
<dl><dt><b><a name='l2h-1213'><tt class='function'>noecho</tt></a></b> ()
<dd>
Leave echo mode.  Echoing of input characters is turned off,
</dl>

<P>
<dl><dt><b><a name='l2h-1214'><tt class='function'>nonl</tt></a></b> ()
<dd>
Leave newline mode.  Disable translation of return into newline on
input, and disable low-level translation of newline into
newline/return on output (but this does not change the behavior of
<code>addch('&#92;n')</code>, which always does the equivalent of return and
line feed on the virtual screen).  With translation off, curses can
sometimes speed up vertical motion a little; also, it will be able to
detect the return key on input.
</dl>

<P>
<dl><dt><b><a name='l2h-1215'><tt class='function'>noqiflush</tt></a></b> ()
<dd>
When the noqiflush routine is used, normal flush of input and
output queues associated with the INTR, QUIT and SUSP
characters will not be done.  You may want to call
<tt class="function">noqiflush()</tt> in a signal handler if you want output
to continue as though the interrupt had not occurred, after the
handler exits.
</dl>

<P>
<dl><dt><b><a name='l2h-1216'><tt class='function'>noraw</tt></a></b> ()
<dd>
Leave raw mode. Return to normal ``cooked'' mode with line buffering.
</dl>

<P>
<dl><dt><b><a name='l2h-1217'><tt class='function'>pair_content</tt></a></b> (<var>pair_number</var>)
<dd>
Returns a tuple <var>(fg,bg)</var> containing the colors for the requested
color pair.  The value of <var>pair_number</var> must be between 0 and
COLOR_PAIRS-1.
</dl>

<P>
<dl><dt><b><a name='l2h-1218'><tt class='function'>pair_number</tt></a></b> (<var>attr</var>)
<dd>
Returns the number of the color-pair set by the attribute value <var>attr</var>.
<tt class="function">color_pair()</tt> is the counterpart to this function.
</dl>

<P>
<dl><dt><b><a name='l2h-1219'><tt class='function'>putp</tt></a></b> (<var>string</var>)
<dd>
Equivalent to <code>tputs(str, 1, putchar)</code>; emits the value of a
specified terminfo capability for the current terminal.  Note that the
output of putp always goes to standard output.
</dl>

<P>
<dl><dt><b><a name='l2h-1220'><tt class='function'>qiflush</tt></a></b> (<big>[</big><var>flag</var><big>]</big>)
<dd>
If <var>flag</var> is false, the effect is the same as calling
<tt class="function">noqiflush()</tt>. If <var>flag</var> is true, or no argument is
provided, the queues will be flushed when these control characters are
read.
</dl>

<P>
<dl><dt><b><a name='l2h-1221'><tt class='function'>raw</tt></a></b> ()
<dd>
Enter raw mode.  In raw mode, normal line buffering and 
processing of interrupt, quit, suspend, and flow control keys are
turned off; characters are presented to curses input functions one
by one.
</dl>

<P>
<dl><dt><b><a name='l2h-1222'><tt class='function'>reset_prog_mode</tt></a></b> ()
<dd>
Restores the  terminal  to ``program'' mode, as previously saved 
by <tt class="function">def_prog_mode()</tt>.
</dl>

<P>
<dl><dt><b><a name='l2h-1223'><tt class='function'>reset_shell_mode</tt></a></b> ()
<dd>
Restores the  terminal  to ``shell'' mode, as previously saved 
by <tt class="function">def_shell_mode()</tt>.
</dl>

<P>
<dl><dt><b><a name='l2h-1224'><tt class='function'>setsyx</tt></a></b> (<var>y, x</var>)
<dd>
Sets the virtual screen cursor to <var>y</var>, <var>x</var>.
If <var>y</var> and <var>x</var> are both -1, then leaveok is set.  
</dl>

<P>
<dl><dt><b><a name='l2h-1225'><tt class='function'>start_color</tt></a></b> ()
<dd>
Must be called if the programmer wants to use colors, and before any
other color manipulation routine is called.  It is good
practice to call this routine right after <tt class="function">initscr()</tt>.

<P>
<tt class="function">start_color()</tt> initializes eight basic colors (black, red, 
green, yellow, blue, magenta, cyan, and white), and two global
variables in the <tt class="module">curses</tt> module, COLORS and COLOR_PAIRS,
containing the maximum number of colors and color-pairs the terminal
can support.  It also restores the colors on the terminal to the
values they had when the terminal was just turned on.
</dl>

<P>
<dl><dt><b><a name='l2h-1226'><tt class='function'>termattrs</tt></a></b> ()
<dd>
Returns a logical OR of all video attributes supported by the
terminal.  This information is useful when a curses program needs
complete control over the appearance of the screen.
</dl>

<P>
<dl><dt><b><a name='l2h-1227'><tt class='function'>termname</tt></a></b> ()
<dd>
Returns the value of the environment variable TERM, truncated to 14
characters.
</dl>

<P>
<dl><dt><b><a name='l2h-1228'><tt class='function'>tigetflag</tt></a></b> (<var>capname</var>)
<dd>
Returns the value of the Boolean capability corresponding to the
terminfo capability name <var>capname</var>.  The value -1 is returned if
<var>capname</var> is not a Boolean capability, or 0 if it is canceled or
absent from the terminal description.
</dl>

<P>
<dl><dt><b><a name='l2h-1229'><tt class='function'>tigetnum</tt></a></b> (<var>capname</var>)
<dd>
Returns the value of the numeric capability corresponding to the
terminfo capability name <var>capname</var>.  The value -2 is returned if
<var>capname</var> is not a numeric capability, or -1 if it is canceled or absent
from the terminal description.  
</dl>

<P>
<dl><dt><b><a name='l2h-1230'><tt class='function'>tigetstr</tt></a></b> (<var>capname</var>)
<dd>
Returns the value of the string capability corresponding to the
terminfo capability name <var>capname</var>.  <code>None</code> is returned if
<var>capname</var> is not a string capability, or is canceled or absent
from the terminal description.
</dl>

<P>
<dl><dt><b><a name='l2h-1231'><tt class='function'>typeahead</tt></a></b> (<var>fd</var>)
<dd>
Specifies that the file descriptor <var>fd</var> be used for typeahead
checking.  If <var>fd</var> is -1, then no typeahead checking is done.

<P>
The curses library does ``line-breakout optimization'' by looking for
typeahead periodically while updating the screen.  If input is found,
and it is coming from a tty, the current update is postponed until
refresh or doupdate is called again, allowing faster response to
commands typed in advance. This function allows specifying a different
file descriptor for typeahead checking.
</dl>

<P>
<dl><dt><b><a name='l2h-1232'><tt class='function'>unctrl</tt></a></b> (<var>ch</var>)
<dd>
Returns a string which is a printable representation of the character
<var>ch</var>.  Control characters are displayed as a caret followed by the
character, for example as <code>^C</code>. Printing characters are left as they
are.
</dl>

<P>
<dl><dt><b><a name='l2h-1233'><tt class='function'>ungetch</tt></a></b> (<var>ch</var>)
<dd>
Push <var>ch</var> so the next <tt class="method">getch()</tt> will return it.
<b>Note:</b> only one <var>ch</var> can be pushed before <tt class="method">getch()</tt>
is called.
</dl>

<P>
<dl><dt><b><a name='l2h-1234'><tt class='function'>ungetmouse</tt></a></b> (<var>id, x, y, z, bstate</var>)
<dd>
Push a <tt class="constant">KEY_MOUSE</tt> event onto the input queue, associating
the given state data with it.
</dl>

<P>
<dl><dt><b><a name='l2h-1235'><tt class='function'>use_env</tt></a></b> (<var>flag</var>)
<dd>
If used, this function should be called before <tt class="function">initscr</tt> or
newterm are called.  When <var>flag</var> is false, the values of
lines and columns specified in the terminfo database will be
used, even if environment variables LINES and COLUMNS (used by
default) are set, or if curses is running in a window (in which
case default behavior would be to use the window size if LINES
and COLUMNS are not set).
</dl>

<P>

<DIV CLASS="navigation"><p><hr><table align="center" width="100%" cellpadding="0" cellspacing="2">
<tr>
<td><A href="module-curses.html" tppabs="http://www.python.org/doc/current/lib/module-curses.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="curses-window-objects.html" tppabs="http://www.python.org/doc/current/lib/curses-window-objects.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="module-curses.html" tppabs="http://www.python.org/doc/current/lib/module-curses.html">6.12 curses  </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="curses-window-objects.html" tppabs="http://www.python.org/doc/current/lib/curses-window-objects.html">6.12.2 Window Objects</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 + -