TTY – TTY handle

class uv.TTY(fd, readable=False, loop=None, on_read=None)[source]

Stream interface to the local user terminal console. It allows using ANSI escape codes across platforms.

Raises:

uv.UVError – error while initializing the handle

Parameters:
  • fd (int) – file descriptor of the console
  • readable (bool) – specifies whether the file descriptor is readable or not
  • loop (uv.Loop) – event loop the handle should run on
  • on_read (Callable[[uv.TTY, uv.StatusCodes, bytes], None]) – callback which should be called when data has been read
console_size

Current size of the console.

Raises:uv.UVError – error while getting console size
Return type:ConsoleSize
set_mode(mode=<uv.helpers.mock.Mock object>)[source]

Set the the specified terminal mode.

Raises:
  • uv.UVError – error while setting mode
  • uv.ClosedHandleError – handle has already been closed or is closing
Parameters:

mode (uv.TTYMode) – mode to set

class uv.TTYMode[source]

Terminal modes enumeration.

NORMAL

Initial normal terminal mode.

Type:uv.TTYMode
RAW

Raw input mode (on windows, ENABLE_WINDOW_INPUT is also enabled).

Type:uv.TTYMode
IO

Binary-safe IO mode for IPC (Unix only).

Type:uv.TTYMode
class uv.ConsoleSize[source]
width

Width of the console.

Readonly:True
Type:int
height

Height of the console.

Readonly:True
Type:int