Skip to main content

Functions related to terminals.

Latest release 20200521:

  • New status() function dragged in from cs.logutils, which uses cs.upd for status() -- needs some refactoring to match with the other functions in cs.tty -- text vs bytes, stdout vs stderr, etc.
  • Get warning() from cs.gimmicks.

Function setupterm(*args)

Run curses.setupterm, needed to be able to use the status line. Uses a global flag to avoid doing this twice.

Function status(msg, *args, **kwargs)

Write a message to the terminal's status line.

Parameters:

  • msg: message string
  • args: if not empty, the message is %-formatted with args
  • file: optional keyword argument specifying the output file. Default: sys.stderr.

Hack: if there is no status line use the xterm title bar sequence :-(

Function statusline(text, fd=None, reverse=False, xpos=None, ypos=None)

Update the status line.

Function statusline_bs(text, reverse=False, xpos=None, ypos=None)

Return a byte string to update the status line.

Function ttysize(fd)

Return a (rows, columns) tuple for the specified file descriptor.

If the window size cannot be determined, None will be returned for either or both of rows and columns.

This function relies on the UNIX stty command.

Class WinSize(builtins.tuple)

WinSize(rows, columns)

Release Log

Release 20200521:

  • New status() function dragged in from cs.logutils, which uses cs.upd for status() -- needs some refactoring to match with the other functions in cs.tty -- text vs bytes, stdout vs stderr, etc.
  • Get warning() from cs.gimmicks.

Release 20190101: Small bugfix for setupterm.

Release 20170903: add statusline and statusline_s functions; ttysize: support BSD stty output format

Release 20160828: Use "install_requires" instead of "requires" in DISTINFO, add PyPI category.

Release 20150116: Initial PyPI release.

Release files for cs-tty 20200521

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for cs-tty 20200521
File Size Uploaded
cs.tty-20200521.tar.gz 3.7 kB Details

Release files / cs.tty-20200521.tar.gz

Download URL cs.tty-20200521.tar.gz
Size 3.7 kB
Tags Source
SHA-256 checksum
How to use checksums
9beb4a93f631ec0b74044c63b30c8e2ccc55f9fea0cdf3bd9edd2a8fdb341d28
BLAKE2b-256 checksum
How to use checksums
c1c47fd144f7836bb2ae23abd6b039c6c728cbe3aaaf013bf092025bf467c685
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.7.7

Release history Release notifications | RSS feed

This release

20200521 This release

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page