Skip to main content

Terminal/console pager module for Python

Project description

Python module to page screen output and get dimensions of available console space.

It is meant to be finally included into standard library http://bugs.python.org/issue8408

Author: anatoly techtonik <techtonik@gmail.com>
License: Public Domain (or MIT if a license is required)

Status

0.2 (stable)
  • do not insert blank line between pages

0.1 (stable)
  • shows content page by page

  • allows to get console/terminal dimensions

  • works on Windows

  • works on Linux

API

..function:: getwidth()

Return width of available window in characters. If detection fails, return value of standard width 80. Coordinate of the last character on a line is -1 from returned value.

..function:: getheight()

Return available window height in characters or 25 if detection fails. Coordinate of the last line is -1 from returned value.

..function:: getch()

Wait for keypress and return character in a cross-platform way. Credits: Danny Yoo, Python Cookbook

..function:: page(content, [pagecallback=prompt])

Output content iterable, calling pagecallback function after each page. Default prompt() callback shows ‘Press any key … ‘ prompt and waits for keypress.

References

Excellent tutorials for Win32 Console by Adrian Worley http://www.adrianxw.dk/SoftwareSite/index.html Console Reference on MSDN http://msdn.microsoft.com/en-us/library/ms682087%28VS.85%29.aspx

Public Domain Curses library maintained by William McBrine http://pdcurses.sourceforge.net/

Ioctl (input/output control) introduction from Wikipedia http://en.wikipedia.org/wiki/Ioctl Linux Programmer’s Manual - ioctls for terminals and serial lines http://www.kernel.org/doc/man-pages/online/pages/man4/tty_ioctl.4.html

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

pager-0.2.tar.gz (5.1 kB view details)

Uploaded Source

File details

Details for the file pager-0.2.tar.gz.

File metadata

  • Download URL: pager-0.2.tar.gz
  • Upload date:
  • Size: 5.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for pager-0.2.tar.gz
Algorithm Hash digest
SHA256 6306a20a76071a1c37123e6e36ccc6db31623755592fed5b60bf129e7b3bf538
MD5 2585cd72aa843f56bdcb6b470a170964
BLAKE2b-256 f76d05604d40bc4a3eeb50d5a3d673fbda8384212810408b8356ace41f393c8e

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