TTY — TTY controlling handle

class pyuv.TTY(loop, fd, readable)
Parameters:
  • loop (Loop) – loop object where this handle runs (accessible through TTY.loop).
  • fd (int) – File descriptor to be opened as a TTY.
  • readable (bool) – Specifies if the given fd is readable.

The TTY handle provides asynchronous stdin / stdout functionality.

shutdown([callback])
Parameters:callback (callable) – Callback to be called after shutdown has been performed.

Shutdown the outgoing (write) direction of the TTY connection.

Callback signature: callback(tty_handle).

write(data[, callback])
Parameters:
  • data (object) – Data to be written on the TTY connection. It can be any Python object conforming to the buffer interface.
  • callback (callable) – Callback to be called after the write operation has been performed.

Write data on the TTY connection.

Callback signature: callback(tcp_handle, error).

writelines(seq[, callback])
Parameters:
  • seq (object) – Data to be written on the TTY connection. It can be any iterable object and the same logic is applied for the contained elements as in the write method.
  • callback (callable) – Callback to be called after the write operation has been performed.

Write data on the TTY connection.

Callback signature: callback(tcp_handle, error).

start_read(callback)
Parameters:callback (callable) – Callback to be called when data is read.

Start reading for incoming data.

Callback signature: callback(status_handle, data).

stop_read()

Stop reading data.

set_mode(mode)
Parameters:mode (int) – TTY mode. 0 for normal, 1 for raw.

Set TTY mode.

get_winsize()

Get terminal window size.

classmethod reset_mode()

Reset TTY settings. To be called when program exits.

write_queue_size

Read only

Returns the size of the write queue.

readable

Read only

Indicates if this handle is readable.

writable

Read only

Indicates if this handle is writable.