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

Uploaded Source

File details

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

File metadata

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

File hashes

Hashes for vt102-0.2.1.tar.gz
Algorithm Hash digest
SHA256 5ba9b5230cd438ebcfbc26411d5f6bd95c4c20b0269c5d836b5f816fd83768d0
MD5 288d71954f109f82cf56f85926daf704
BLAKE2b-256 af29c09ab0294922601095e61f68a0979bda9d15a52a6d8970c0345680e881c6

See more details on using hashes here.

Supported by

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