Skip to main content

term2web: terminal in a web page (Python version)

Run on Repl.it About online demonstrations

license: MIT Version

Notice française : https://q37.info/s/rhj9qmb9.

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

Install (pip install term2web), import (from term2web import *) on the top of your program, 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).

Online 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. Comment out the import * from term2web for the program to run in the usual way in a terminal.

WithCSS.py shows how CSS rules can be used to format the displayed text.

You can still use the default print(…) and input(…) after an import builtins with builtins.print(…) and builtins.input(…).

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.

Release files for term2web 0.0.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for term2web 0.0.4
File Size Uploaded
term2web-0.0.4.tar.gz 5.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for term2web 0.0.4
File Interpreter ABI Platform
term2web-0.0.4-py3-none-any.whl Python 3 none any Details

Total release size: 11.8 kB

Release files / term2web-0.0.4.tar.gz

Download URL term2web-0.0.4.tar.gz
Size 5.4 kB
Tags Source
SHA-256 checksum
How to use checksums
ac22398c0e239545a03c5d045dd92470982070c474033cb1b130ffda9be71a17
BLAKE2b-256 checksum
How to use checksums
d40c9106fec45a6b21341dd698c2d6e6c03cb3445c6977489fa0ac530118e7f7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/47.1.1 requests-toolbelt/0.9.1 tqdm/4.37.0 CPython/3.6.9

Release files / term2web-0.0.4-py3-none-any.whl

Download URL term2web-0.0.4-py3-none-any.whl
Size 6.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6470c81afdd8b9c00a6d4e7b292b5d0597785018b99043a67988a129ac0f092d
BLAKE2b-256 checksum
How to use checksums
e18b1cc707d22d2e9d945ecad1c2edddd7e8626367923295c76eb151fe8f1865
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/47.1.1 requests-toolbelt/0.9.1 tqdm/4.37.0 CPython/3.6.9

Release history Release notifications | RSS feed

This release

0.0.4 This release

2 release files

0.0.3

2 release files

0.0.2

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page