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

📄 module-termios.html

📁 一本很好的python的说明书,适合对python感兴趣的人
💻 HTML
字号:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>8.8 termios -- POSIX style tty control</title>
<META NAME="description" CONTENT="8.8 termios -- POSIX style tty control">
<META NAME="keywords" CONTENT="lib">
<META NAME="resource-type" CONTENT="document">
<META NAME="distribution" CONTENT="global">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="STYLESHEET" href="lib.css" tppabs="http://www.python.org/doc/current/lib/lib.css">
<LINK REL="next" href="module-TERMIOSuppercase.html" tppabs="http://www.python.org/doc/current/lib/module-TERMIOSuppercase.html">
<LINK REL="previous" href="module-gdbm.html" tppabs="http://www.python.org/doc/current/lib/module-gdbm.html">
<LINK REL="up" href="unix.html" tppabs="http://www.python.org/doc/current/lib/unix.html">
<LINK REL="next" href="termios_Example.html" tppabs="http://www.python.org/doc/current/lib/termios_Example.html">
</head>
<body>
<DIV CLASS="navigation"><table align="center" width="100%" cellpadding="0" cellspacing="2">
<tr>
<td><A href="module-gdbm.html" tppabs="http://www.python.org/doc/current/lib/module-gdbm.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="unix.html" tppabs="http://www.python.org/doc/current/lib/unix.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="termios_Example.html" tppabs="http://www.python.org/doc/current/lib/termios_Example.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-gdbm.html" tppabs="http://www.python.org/doc/current/lib/module-gdbm.html">8.7 gdbm  </A>
<b class="navlabel">Up:</b> <a class="sectref" href="unix.html" tppabs="http://www.python.org/doc/current/lib/unix.html">8. Unix Specific Services</A>
<b class="navlabel">Next:</b> <a class="sectref" href="termios_Example.html" tppabs="http://www.python.org/doc/current/lib/termios_Example.html">8.8.1 Example</A>
<br><hr></DIV>
<!--End of Navigation Panel-->

<H1><A NAME="SECTION0010800000000000000000">
8.8 <tt class="module">termios</tt> --
         POSIX style tty control</A>
</H1>

<P>
  
<p class='availability'>Availability: <span
 class='platform'>Unix</span>.</p>

<P>


<P>
This module provides an interface to the POSIX calls for tty I/O
control.  For a complete description of these calls, see the POSIX or
Unix manual pages.  It is only available for those Unix versions
that support POSIX <i>termios</i> style tty I/O control (and then
only if configured at installation time).

<P>
All functions in this module take a file descriptor <var>fd</var> as their
first argument.  This must be an integer file descriptor, such as
returned by <code>sys.stdin.fileno()</code>.

<P>
This module should be used in conjunction with the
<tt class='module'><a href="module-TERMIOSuppercase.html" tppabs="http://www.python.org/doc/current/lib/module-TERMIOSuppercase.html">TERMIOS</a></tt> module,
which defines the relevant symbolic constants (see the next section).

<P>
The module defines the following functions:

<P>
<dl><dt><b><a name='l2h-1849'><tt class='function'>tcgetattr</tt></a></b> (<var>fd</var>)
<dd>
Return a list containing the tty attributes for file descriptor
<var>fd</var>, as follows: <code>[</code><var>iflag</var>, <var>oflag</var>, <var>cflag</var>,
<var>lflag</var>, <var>ispeed</var>, <var>ospeed</var>, <var>cc</var><code>]</code> where
<var>cc</var> is a list of the tty special characters (each a string of
length 1, except the items with indices <tt class="constant">TERMIOS.VMIN</tt> and
<tt class="constant">TERMIOS.VTIME</tt>, which are integers when these fields are
defined).  The interpretation of the flags and the speeds as well as
the indexing in the <var>cc</var> array must be done using the symbolic
constants defined in the <tt class='module'><a href="module-TERMIOSuppercase.html" tppabs="http://www.python.org/doc/current/lib/module-TERMIOSuppercase.html">TERMIOS</a></tt>
module.
</dl>

<P>
<dl><dt><b><a name='l2h-1850'><tt class='function'>tcsetattr</tt></a></b> (<var>fd, when, attributes</var>)
<dd>
Set the tty attributes for file descriptor <var>fd</var> from the
<var>attributes</var>, which is a list like the one returned by
<tt class="function">tcgetattr()</tt>.  The <var>when</var> argument determines when the
attributes are changed: <tt class="constant">TERMIOS.TCSANOW</tt> to change
immediately, <tt class="constant">TERMIOS.TCSADRAIN</tt> to change after transmitting
all queued output, or <tt class="constant">TERMIOS.TCSAFLUSH</tt> to change after
transmitting all queued output and discarding all queued input.
</dl>

<P>
<dl><dt><b><a name='l2h-1851'><tt class='function'>tcsendbreak</tt></a></b> (<var>fd, duration</var>)
<dd>
Send a break on file descriptor <var>fd</var>.  A zero <var>duration</var> sends
a break for 0.25-0.5 seconds; a nonzero <var>duration</var> has a system
dependent meaning.
</dl>

<P>
<dl><dt><b><a name='l2h-1852'><tt class='function'>tcdrain</tt></a></b> (<var>fd</var>)
<dd>
Wait until all output written to file descriptor <var>fd</var> has been
transmitted.
</dl>

<P>
<dl><dt><b><a name='l2h-1853'><tt class='function'>tcflush</tt></a></b> (<var>fd, queue</var>)
<dd>
Discard queued data on file descriptor <var>fd</var>.  The <var>queue</var>
selector specifies which queue: <tt class="constant">TERMIOS.TCIFLUSH</tt> for the
input queue, <tt class="constant">TERMIOS.TCOFLUSH</tt> for the output queue, or
<tt class="constant">TERMIOS.TCIOFLUSH</tt> for both queues.
</dl>

<P>
<dl><dt><b><a name='l2h-1854'><tt class='function'>tcflow</tt></a></b> (<var>fd, action</var>)
<dd>
Suspend or resume input or output on file descriptor <var>fd</var>.  The
<var>action</var> argument can be <tt class="constant">TERMIOS.TCOOFF</tt> to suspend
output, <tt class="constant">TERMIOS.TCOON</tt> to restart output,
<tt class="constant">TERMIOS.TCIOFF</tt> to suspend input, or
<tt class="constant">TERMIOS.TCION</tt> to restart input. 
</dl>

<P>
<div class='seealso'>
  <p class='heading'><b>See Also:</b></p>

  <dl compact class="seemodule">
    <dt>Module <b><tt class='module'><a href="module-TERMIOSuppercase.html" tppabs="http://www.python.org/doc/current/lib/module-TERMIOSuppercase.html">TERMIOS</a></tt>:</b>
    <dd>Constants for use with
                                        <tt class="module">termios</tt>.
  </dl>
  <dl compact class="seemodule">
    <dt>Module <b><tt class='module'><a href="module-tty.html" tppabs="http://www.python.org/doc/current/lib/module-tty.html">tty</a></tt>:</b>
    <dd>Convenience functions for common terminal control
                  operations.
  </dl>
</div>

<P>

<p><hr>
<!--Table of Child-Links-->
<A NAME="CHILD_LINKS"><STRONG>Subsections</STRONG></A>

<UL>
<LI><A NAME="tex2html3382"
  href="termios_Example.html" tppabs="http://www.python.org/doc/current/lib/termios_Example.html">8.8.1 Example</A>
</UL>
<!--End of Table of Child-Links-->

<DIV CLASS="navigation"><p><hr><table align="center" width="100%" cellpadding="0" cellspacing="2">
<tr>
<td><A href="module-gdbm.html" tppabs="http://www.python.org/doc/current/lib/module-gdbm.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="unix.html" tppabs="http://www.python.org/doc/current/lib/unix.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="termios_Example.html" tppabs="http://www.python.org/doc/current/lib/termios_Example.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-gdbm.html" tppabs="http://www.python.org/doc/current/lib/module-gdbm.html">8.7 gdbm  </A>
<b class="navlabel">Up:</b> <a class="sectref" href="unix.html" tppabs="http://www.python.org/doc/current/lib/unix.html">8. Unix Specific Services</A>
<b class="navlabel">Next:</b> <a class="sectref" href="termios_Example.html" tppabs="http://www.python.org/doc/current/lib/termios_Example.html">8.8.1 Example</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 + -