Toolkit which overloads 'print(…)' and 'input()' to redirect them to a web page.
Project description
term2web: terminal in a web page (Python 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 directlypython3 Basic.py
orpython3 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.
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
Built Distribution
File details
Details for the file term2web-0.0.4.tar.gz
.
File metadata
- Download URL: term2web-0.0.4.tar.gz
- Upload date:
- Size: 5.4 kB
- Tags: Source
- Uploaded using 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
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ac22398c0e239545a03c5d045dd92470982070c474033cb1b130ffda9be71a17 |
|
MD5 | 290dab0e21e72d0016dd173789ec1313 |
|
BLAKE2b-256 | d40c9106fec45a6b21341dd698c2d6e6c03cb3445c6977489fa0ac530118e7f7 |
File details
Details for the file term2web-0.0.4-py3-none-any.whl
.
File metadata
- Download URL: term2web-0.0.4-py3-none-any.whl
- Upload date:
- Size: 6.4 kB
- Tags: Python 3
- Uploaded using 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
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6470c81afdd8b9c00a6d4e7b292b5d0597785018b99043a67988a129ac0f092d |
|
MD5 | d6abffc922bb965f18678d28846c67a4 |
|
BLAKE2b-256 | e18b1cc707d22d2e9d945ecad1c2edddd7e8626367923295c76eb151fe8f1865 |