Skip to content

Introduction

Termage is a wrapper library for PyTermGUI's SVG export functionalities. Other than providing the module, it also offers a CLI and an MkDocs plugin to put SVGs just about anywhere you can think of.

Termage has native support for capturing applications based on PyTermGUI's WindowManager!

from pytermgui import tim, ColorPicker
from pytermgui.pretty import print

tim.print("Welcome to [!gradient(112) bold]Termage[/]!\n")
tim.print("Termage allows you to display [italic]any[/italic] terminal output in a terminal-mimicking [bold]SVG[/bold]!")

tim.print("\nHere are the current locals:")
print(locals())

Hey there! Welcome to  T e r m a ge ! Termage allows you to display  any  terminal output in a terminal-mimicking  SVG ! Here are the current locals: {    '__name__' '__main__'    '__doc__' None    '__package__' None    '__annotations__' : {}    '__builtins__' : < module   'builtins'  (built-in)>,     'termage' : <termage.execution. TermageNamespace   object  at  0x1042b5d60 >,     'tim' : <pytermgui.markup.language. MarkupLanguage   object  at  0x1043b74f0 >,     'ColorPicker' : < class   'pytermgui.widgets.color_picker.ColorPicker' >,     'print' : < function  pprint at  0x1044ed3a0 > }

Installation

Termage is best installed using pip:

$ pip install termage

This will install PyTermGUI, as well as Termage. The MkDocs plugin is included within the installation as well.

import pytermgui as ptg

with ptg.WindowManager() as manager:
    manager.layout.add_slot("Body")
    manager.add(
        ptg.Window(
            ptg.inspect(ptg.inspect),
            box="EMPTY",
        ),
    )

My SVG                                                                                                                                                                             ────────────────────────────────────────────────────────────────────────────────── │                              pytermgui.inspector.inspect                             │ │        Located in  /Users/lapis/Code/Projects/pytermgui/pytermgui/inspector.py        │ ────────────────────────────────────────────────────────────────────────────────── def   inspect (target:  object , **inspector_args:  Any ) ->  Inspector :                           Inspects an object.                                                                                                                                                          Args:                                                                                      target: The object to inspect.                                                         **inspector_args: See `Inspector.__init__`.