tty — 终端控制函数

源代码: Lib/tty.py


The tty module defines functions for putting the tty into cbreak and raw modes.

可用性 :Unix。

Because it requires the termios module, it will work only on Unix.

The tty 模块定义了下列函数:

tty. cfmakeraw ( mode )

Convert the tty attribute list mode , which is a list like the one returned by termios.tcgetattr() , to that of a tty in raw mode.

3.12 版添加。

tty. cfmakecbreak ( mode )

Convert the tty attribute list mode , which is a list like the one returned by termios.tcgetattr() , to that of a tty in cbreak mode.

This clears the ECHO and ICANON local mode flags in mode as well as setting the minimum input to 1 byte with no delay.

3.12 版添加。

Changed in version 3.12.2: The ICRNL flag is no longer cleared. This matches Linux and macOS stty cbreak behavior and what setcbreak() historically did.