Skip to main content

Toolkit which overloads 'print(…)' and 'input()' to redirect them to a web page.

Project description

term2web: terminal in a web page (Python version)

Run on Repl.it Version license: MIT

This library is like termcolor, but with all the formatting possibility of CSS.

Install (pip install term2web), import (from term2web import *) and all print(…) and input(…) will be redirected to a web page.

You can also launch:

  • git clone http://github.com/epeios-q37/term2web-python,
  • cd term2web-python,
  • python3 main.py (or directly python3 Basic.py or python3 WithCSS.py).

Live demonstration: https://q37.info/s/kjjcfcp3.

There are three other functions available.

set_property(name,value) applies the CSS property of name name and value value.

Example:

set_property("font-style": "italic")

set_properties(properties) applies the CSS properties stored in properties which is a dictionary whose keys are property names, and values the corresponding property values.

Example:

set_properties({
    "text-decoration-line": "line-through"
    "text-decoration-style": "wavy",
    "text-decoration-color": "red"
})

reset_properties() removes all the CSS properties set by above functions.

Basic.py is an example with calls to print(…) and input(…), but without CSS formatting.

WithCSS.py shows how CSS is used to format the displayed text.

There is also a stub to for this library at address https://q37.info/s/qh99qtjt.

Unlike other programs based on the Atlas toolkit, on which this library is based, it is not possible to simultaneously launch two or more instances of a program based on the term2web library. This is intentional, in order to keep this library simple to use, as it is mainly intended for beginners.


This project is based on the Atlas toolkit. Other projects using this toolkit can be found here: https://q37.info/s/sssznrb4.

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

term2web-0.0.2.tar.gz (5.2 kB view hashes)

Uploaded Source

Built Distribution

term2web-0.0.2-py3-none-any.whl (6.4 kB view hashes)

Uploaded Python 3

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