Skip to main content

Record animated GIFs of Textual terminal apps

Project description

termgif

Record animated GIFs of Textual terminal apps.

pip install termgif
termgif record myapp.py:MyApp --tape demo.tape --output demo.gif

No screen capture. No window focus tricks. Drives your app headlessly via Textual's Pilot API, renders each SVG frame through a real browser (Playwright), assembles with Pillow. Works on Windows, macOS, Linux.

install

pip install termgif
playwright install chromium

quick start

1. Scaffold a tape file:

termgif init

This writes a demo.tape in the current directory. Edit it to match your app.

2. Record:

termgif record path/to/yourapp.py:YourApp --tape demo.tape

Outputs demo.gif by default.

tape format

size: [120, 30]       # terminal cols × rows
gif_width: 900        # output GIF width in pixels
app_args: {}          # kwargs passed to your App constructor

steps:
  - sleep: 3.0        # wait for app to load
    capture: 2000     # snapshot and hold this frame 2s in the GIF

  - press: a          # press a key
    sleep: 0.4
    capture: 1200

  - type: "hello"     # type a string
    sleep: 0.5
    capture: 1000

  - press: enter
    sleep: 0.2
    capture: 800

Each step can have:

  • press — a single key name (a, space, enter, ctrl+c, etc.)
  • type — a string to type character by character
  • sleep — seconds to wait after the action
  • capture — take a snapshot and hold it this many ms in the output GIF

Steps without capture perform their action without recording a frame.

passing constructor args

app_args:
  root: /home/user/projects
  older_than: 30
  min_size_mb: 10

CLI reference

termgif record APP [--tape FILE] [--output FILE] [--width PX]
termgif init [--output FILE]

APP is path/to/file.py:ClassName or module.path:ClassName.

requirements

  • Python 3.10+
  • Textual 0.80+
  • Playwright (Chromium)
  • Pillow

license

MIT

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

tapegif-0.1.0.tar.gz (8.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

tapegif-0.1.0-py3-none-any.whl (10.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: tapegif-0.1.0.tar.gz
  • Upload date:
  • Size: 8.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.12

File hashes

Hashes for tapegif-0.1.0.tar.gz
Algorithm Hash digest
SHA256 3591ebfa0491df7c98d759e9ba1cbf34d13db341dfa6e0e1f722a9d52137e037
MD5 c8f3aebfe459455747a0a3ead3908bb4
BLAKE2b-256 1152a85dee514d037901f3c1b32e4bb6f19f7909dbec66298e18513df88ab5bc

See more details on using hashes here.

File details

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

File metadata

  • Download URL: tapegif-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 10.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.12

File hashes

Hashes for tapegif-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f013b848c6327980bcd4fc047292e106f0f86506a5c13073a03c18ace847edc6
MD5 f1fd49771a51b97d6d1f7f44e8f5bdee
BLAKE2b-256 3f3b5d82ff1e1f9acb9c9bffa50a4650a2ecd28ab098aa5ead20fbf5798bd00b

See more details on using hashes here.

Supported by

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