2019-04-08 23:22:26 +08:00

1 line
3.5 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<div class="body" role="main"><div class="section" id="module-tty"><h1><span class="yiyi-st" id="yiyi-10">35.7. <a class="reference internal" href="#module-tty" title="tty: Utility functions that perform common terminal control operations. (Unix)"><code class="xref py py-mod docutils literal"><span class="pre">tty</span></code></a> - 终端控制功能</span></h1><p><span class="yiyi-st" id="yiyi-11"><strong>源代码:</strong> <a class="reference external" href="https://hg.python.org/cpython/file/3.5/Lib/tty.py">Lib / tty.py</a></span></p><p><span class="yiyi-st" id="yiyi-12"><a class="reference internal" href="#module-tty" title="tty: Utility functions that perform common terminal control operations. (Unix)"><code class="xref py py-mod docutils literal"><span class="pre">tty</span></code></a>模块定义了将tty置于cbreak和raw模式的函数。</span></p><p><span class="yiyi-st" id="yiyi-13">因为它需要<a class="reference internal" href="termios.html#module-termios" title="termios: POSIX style tty control. (Unix)"><code class="xref py py-mod docutils literal"><span class="pre">termios</span></code></a>模块它将仅在Unix上工作。</span></p><p><span class="yiyi-st" id="yiyi-14"><a class="reference internal" href="#module-tty" title="tty: Utility functions that perform common terminal control operations. (Unix)"><code class="xref py py-mod docutils literal"><span class="pre">tty</span></code></a>模块定义以下函数:</span></p><dl class="function"><dt id="tty.setraw"><span class="yiyi-st" id="yiyi-15"> <code class="descclassname">tty.</code><code class="descname">setraw</code><span class="sig-paren">(</span><em>fd</em>, <em>when=termios.TCSAFLUSH</em><span class="sig-paren">)</span></span></dt><dd><p><span class="yiyi-st" id="yiyi-16">将文件描述器<em>fd</em>的模式更改为raw。</span><span class="yiyi-st" id="yiyi-17">如果忽略时<em>,则默认为<code class="xref py py-const docutils literal"><span class="pre">termios.TCSAFLUSH</span></code>,并传递到<a class="reference internal" href="termios.html#termios.tcsetattr" title="termios.tcsetattr"><code class="xref py py-func docutils literal"><span class="pre">termios.tcsetattr()</span></code></a></em></span></p></dd></dl><dl class="function"><dt id="tty.setcbreak"><span class="yiyi-st" id="yiyi-18"> <code class="descclassname">tty.</code><code class="descname">setcbreak</code><span class="sig-paren">(</span><em>fd</em>, <em>when=termios.TCSAFLUSH</em><span class="sig-paren">)</span></span></dt><dd><p><span class="yiyi-st" id="yiyi-19">将文件描述器<em>fd</em>的模式更改为cbreak。</span><span class="yiyi-st" id="yiyi-20">如果忽略时<em>,则默认为<code class="xref py py-const docutils literal"><span class="pre">termios.TCSAFLUSH</span></code>,并传递到<a class="reference internal" href="termios.html#termios.tcsetattr" title="termios.tcsetattr"><code class="xref py py-func docutils literal"><span class="pre">termios.tcsetattr()</span></code></a></em></span></p></dd></dl><div class="admonition seealso"><p class="first admonition-title"><span class="yiyi-st" id="yiyi-21">也可以看看</span></p><dl class="last docutils"><dt><span class="yiyi-st" id="yiyi-22">模块<a class="reference internal" href="termios.html#module-termios" title="termios: POSIX style tty control. (Unix)"><code class="xref py py-mod docutils literal"><span class="pre">termios</span></code></a></span></dt><dd><span class="yiyi-st" id="yiyi-23">低级终端控制接口。</span></dd></dl></div></div></div>