Skip to main content

`resizewin` detects the terminal size.

Project description

resizewin: Detect and configure terminal size

Usage

From a terminal shell

eval `resizewin`

It works with VT100-compatible terminals, including all modern terminal emulators.

From Python code

import sys
import termios

import resizewin

fd = sys.stdin.fileno()
rows, cols = resizewin.get_terminal_size(fd)
termios.tcsetwinsize(fd, (rows, cols))

How it works

In order to detect the terminal size, resizewin first tells the terminal to move the cursor to as far as possible, then asks the terminal for the current cursor's position. It uses the fact that terminals move the cursor to the bottom right corner when told to move the cursor to a row/column position that exceeds screen size.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

resizewin-0.1.0.tar.gz (8.3 kB view details)

Uploaded Source

Built Distribution

resizewin-0.1.0-py3-none-any.whl (5.3 kB view details)

Uploaded Python 3

File details

Details for the file resizewin-0.1.0.tar.gz.

File metadata

  • Download URL: resizewin-0.1.0.tar.gz
  • Upload date:
  • Size: 8.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-requests/2.32.3

File hashes

Hashes for resizewin-0.1.0.tar.gz
Algorithm Hash digest
SHA256 99e3ce98e18c798ff2c0d5857c7711d734925025e2b03d44ac461215c7f1ba6f
MD5 d8e6f46411d4f9989e2e48f011b2d9ca
BLAKE2b-256 3b01b51cc1781ba55f8d28a7eef26844f0ac5168e65c37135af5483e02cc9267

See more details on using hashes here.

File details

Details for the file resizewin-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: resizewin-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 5.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-requests/2.32.3

File hashes

Hashes for resizewin-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ec7cf2f91a06fe239ec91ca91cda844289a8023f2dae1feb27b3fca17a9ebaff
MD5 9f2579ebc1f22227c066e7e42a8d41ea
BLAKE2b-256 7a5db837477cdd56040cbbb7705bf83ca293743a1708c38fd128a590d02d9b0a

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page