Skip to main content

Simple vt102 emulator, useful for screen scraping.

Project description

vt102 implements a subset of the vt102 specification (the subset that should be most useful for use in software). Two classes: stream, which parses the command stream and dispatches events for commands, and screen which, when used with a stream maintains a buffer of strings representing the screen of a terminal.

Why would you ever want to use this?

  • Screen scraping.

  • Cheating at nethack (I swear to god I will ascend)

  • Chicks dig terminals, and err… VT?

Here’s a quick example:

>>> from vt102 import screen, stream
>>> st = stream()
>>> sc = screen((10, 10))
["          ",
 "          ",
 "          ",
 "          ",
 "          ",
 "          ",
 "          ",
 "          ",
 "          ",
 "          "]
>>> sc.attach(st)
>>> st.process("Text goes here")
>>> repr(sc)
["Text goes ",
 "here      ",
 "          ",
 "          ",
 "          ",
 "          ",
 "          ",
 "          ",
 "          ",
 "          "]
>>> st.process("\x1b[H\x1b[K")
>>> repr(sc)
["          ",
 "here      ",
 "          ",
 "          ",
 "          ",
 "          ",
 "          ",
 "          ",
 "          ",
 "          "]

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

vt102-0.4.tar.gz (11.3 kB view details)

Uploaded Source

File details

Details for the file vt102-0.4.tar.gz.

File metadata

  • Download URL: vt102-0.4.tar.gz
  • Upload date:
  • Size: 11.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for vt102-0.4.tar.gz
Algorithm Hash digest
SHA256 219a3c17ab65f5a4eb45026637001a6cb350cc09d71ca65c1df9e32f338fd304
MD5 c2087b1d19451da351294e5726475a52
BLAKE2b-256 fc4bdfd932c399104076667b41d79c5fe2216bf52ff8826857808555eee7945e

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 Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page