Allows the ability to rewrite multiple lines via carriage returns.
Project description
multicarriage
A Python module designed for writing and updating text on multiple lines using the the carriage return.
Usage
Importing Package
import multicarriage
Creating Newlines
Creating newlines prevents text from being overwritten.
multicarriage.MultiCarriage.create_newline(2)
Writing to Screen
multicarriage.MultiCarriage.write("first text", 2, clearline=True)
multicarriage.MultiCarriage.write("second text", 1, clearline=True)
Setting the clearline
parameter to true will erase the current line of which the cursor is on, assuring there will be no overwritten text.
Example of Real Script Usage
Example script that will write and update 3 lines at once.
# example of auto updating epoch and datetime
import multicarriage
import time
import datetime
# creating newlines to avoid overwriting current text
multicarriage.MultiCarriage.create_newline(3)
while True:
try:
timestamp = time.time()
date = datetime.datetime.fromtimestamp(timestamp)
multicarriage.MultiCarriage.write(f"epoch: {timestamp}", 3, clearline=True, flushtxt=True)
multicarriage.MultiCarriage.write(f"epoch (s): {timestamp//1}", 2, clearline=True, flushtxt=True)
multicarriage.MultiCarriage.write(f"datetime string: {date}", 1, clearline=True, flushtxt=True)
time.sleep(1/10)
except KeyboardInterrupt:
raise SystemExit(0)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
multicarriage-1.0.tar.gz
(2.3 kB
view details)
Built Distribution
File details
Details for the file multicarriage-1.0.tar.gz
.
File metadata
- Download URL: multicarriage-1.0.tar.gz
- Upload date:
- Size: 2.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e35e9a985108b92aa6028f7aabe88dd40cdd9e3c50c51cdc719842c90599c3a3 |
|
MD5 | b6a54c78e2358da10fbd85c4d0bbe318 |
|
BLAKE2b-256 | 036f4b109e06c0ad98f713b649f7ff5c78871dce9adc1838173be806455ccac8 |
File details
Details for the file multicarriage-1.0-py3-none-any.whl
.
File metadata
- Download URL: multicarriage-1.0-py3-none-any.whl
- Upload date:
- Size: 2.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4e577ec85b0bf33e057f8a60d48b1307f529b910fe87f52e0037ac5876212c35 |
|
MD5 | 416caee94cd45ebdf4701b4ad1bad777 |
|
BLAKE2b-256 | a04e67f820ee10a07db1a5930911f9035fc2b212da50df64cb8710f1115c79fd |