tty
— Funciones de control de terminal¶
Código fuente: Lib/tty.py
El módulo tty
define funciones para poner la tty en los modos cbreak y raw.
Dado que requiere el módulo termios
, solamente funciona en Unix.
El módulo tty
define las siguientes funciones:
- 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.Nuevo en la versión 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.Nuevo en la versión 3.12.
- tty.setraw(fd, when=termios.TCSAFLUSH)¶
Change the mode of the file descriptor fd to raw. If when is omitted, it defaults to
termios.TCSAFLUSH
, and is passed totermios.tcsetattr()
. The return value oftermios.tcgetattr()
is saved before setting fd to raw mode; this value is returned.
- tty.setcbreak(fd, when=termios.TCSAFLUSH)¶
Change the mode of file descriptor fd to cbreak. If when is omitted, it defaults to
termios.TCSAFLUSH
, and is passed totermios.tcsetattr()
. The return value oftermios.tcgetattr()
is saved before setting fd to cbreak mode; this value is returned.
Ver también
- Módulo
termios
Interfaz de control de la terminal de bajo nivel.