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.1.tar.gz (10.1 kB view details)

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for resizewin-0.1.1.tar.gz
Algorithm Hash digest
SHA256 d8399e3b44f551934c548304179b2d9cb1da768d013d57dc33e7aef2a2b9015e
MD5 e4f73805cab71825b4600c2dec21b3ae
BLAKE2b-256 d41f1162cb68922615c9214b87709040bf029450fbf1aa9d4c65d042393717e8

See more details on using hashes here.

File details

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

File metadata

  • Download URL: resizewin-0.1.1-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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 98066776e741af27f987388249f3458a924dcc368a2b3b0c206a3ef46d1f5c37
MD5 bbb05b5c090a1579e2ad177e984f4130
BLAKE2b-256 633821836fa679bb6c23c5508a051acd0880a9167f5002f64c28a18e17a51714

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