tty
— Terminal control functions终端控制功能¶
Source code: Lib/tty.py
The tty
module defines functions for putting the tty into cbreak and raw modes.tty
模块定义了将tty放入cbreak和raw模式的函数。
Because it requires the 因为它需要termios
module, it will work only on Unix.termios
模块,所以它只能在Unix上工作。
The tty
module defines the following functions:tty
模块定义了以下函数:
-
tty.
setraw
(fd, when=termios.TCSAFLUSH)¶ Change the mode of the file descriptor fd to raw.将文件描述符fd的模式更改为原始模式。If when is omitted, it defaults to如果省略when,则默认为termios.TCSAFLUSH
, and is passed totermios.tcsetattr()
.termios.TCSAFLUSH
,并传递给termios.tcsetattr()
。
-
tty.
setcbreak
(fd, when=termios.TCSAFLUSH)¶ Change the mode of file descriptor fd to cbreak.将文件描述符fd的模式更改为cbreak。If when is omitted, it defaults to如果省略when,则默认为termios.TCSAFLUSH
, and is passed totermios.tcsetattr()
.termios.TCSAFLUSH
,并传递给termios.tcsetattr()
。
See also
- Module
termios
Low-level terminal control interface.低电平终端控制接口。