Display-tty

Latest version: v1.0.2

Safety actively analyzes 623518 Python packages for vulnerabilities to keep your Python projects secure.

Scan your dependencies

1.0.1

Display tty

![PyPI - Python Version](https://img.shields.io/pypi/pyversions/display_tty) ![PyPI - Implementation](https://img.shields.io/pypi/implementation/display_tty) ![PyPI - Wheel](https://img.shields.io/pypi/wheel/display_tty) ![PyPI - Version](https://img.shields.io/pypi/v/display_tty?label=pypi%20package:%20display_tty) ![PyPI - Downloads](https://img.shields.io/pypi/dm/display_tty) ![PyPI - License](https://img.shields.io/pypi/l/display_tty) ![Execution status](https://github.com/Hanra-s-work/display_tty/actions/workflows/python-package.yml/badge.svg) ![GitHub Workflow Status (with event)](https://img.shields.io/github/actions/workflow/status/Hanra-s-work/display_tty/python-package.yml) ![GitHub repo size](https://img.shields.io/github/repo-size/Hanra-s-work/display_tty) ![GitHub Repo stars](https://img.shields.io/github/stars/Hanra-s-work/display_tty) ![GitHub commit activity (branch)](https://img.shields.io/github/commit-activity/m/Hanra-s-work/display_tty) ![GitHub last commit (branch)](https://img.shields.io/github/last-commit/Hanra-s-work/display_tty/main)

[![Static Badge](https://img.shields.io/badge/Buy_me_a_tea-Hanra-%235F7FFF?style=flat-square&logo=buymeacoffee&label=Buy%20me%20a%20coffee&labelColor=%235F7FFF&color=%23FFDD00&link=https%3A%2F%2Fwww.buymeacoffee.com%2Fhanra)](https://www.buymeacoffee.com/hanra)

Description

This is a python package I created in order to simplify the boiling process for displaying text in a geometrical shape drawn using characters.

Disclaimer

The package was originally named `disp` but had to be changed to `display_tty` because the names `disp` and `display` were already taken by other packages.

The class will still remain `Disp` but bindings named `Display`, `DispTTY` and `DisplayTTY` are available.

The Preloaded version exists under: `IDISP`, `IDISPLAY`, `IDTTY` and `IDISPTTY`

Table of Content

1. [Display tty](display-tty)
2. [Description](description)
3. [Disclaimer](disclaimer)
4. [Table of Content](table-of-content)
5. [Installation](installation)
1. [Using pip](using-pip)
2. [Using python](using-python)
6. [Usage](usage)
1. [Importing](importing)
2. [Initialising](initialising)
3. [Calling the tree function](calling-the-tree-function)
4. [Displaying a beautified Hello World](displaying-a-beautified-hello-world)
1. [Hello World as a title](hello-world-as-a-title)
2. [Hello World as a sub title](hello-world-as-a-sub-title)
3. [Hello World as a sub sub title](hello-world-as-a-sub-sub-title)
4. [Hello World as a message with adjustable delay per call](hello-world-as-a-message-with-adjustable-delay-per-call)
5. [Hello World as a message](hello-world-as-a-message)
6. [Hello World as a question message](hello-world-as-a-question-message)
7. [Hello World as an error message](hello-world-as-an-error-message)
8. [Hello World as a success message](hello-world-as-a-success-message)
9. [Hello World as a warning message](hello-world-as-a-warning-message)
10. [Hello World as an inform message](hello-world-as-an-inform-message)
7. [Change the initialisation content](change-the-initialisation-content)
1. [TOML configuration breakdown](toml-configuration-breakdown)
1. [line 1](line-1)
2. [line 2](line-2)
3. [line 3](line-3)
4. [line 4](line-4)
5. [line 5](line-5)
6. [line 6](line-6)
7. [line 7](line-7)
8. [line 8](line-8)
9. [line 9](line-9)
10. [line 10](line-10)
11. [line 11](line-11)
12. [line 12](line-12)
13. [line 13](line-13)
14. [line 14](line-14)
15. [line 15](line-15)
16. [line 16](line-16)
17. [line 17](line-17)
2. [Update the configuration of an initialised class](update-the-configuration-of-an-initialised-class)
8. [Author](author)
9. [Version](version)

Installation

Using pip

sh
pip install -U disp


Using python

Under Windows:

bat
py -m pip install -U display_tty


Under Linux/Mac OS:

sh
python3 -m pip install -U display_tty


Usage

Importing

py
from display_tty import IDTTY


Initialising

The generic class is: `Disp(toml_content: dict, save_to_file: bool = False, file_name: str = "text_output_run.txt", file_descriptor: any = None)`

For your convenience, you can use the `IDTTY` variable which is an initialised version of the class.

py
IDTTY.title("Hello World")


Otherwise, if you wish to initialise the class with your own parameters, you can do so like this:

py
from display_tty import DisplayTTY
TOML_CONF = {
'PRETTIFY_OUTPUT': True,
'PRETTY_OUTPUT_IN_BLOCS': True,
'MESSAGE_CHARACTER': '',
'MESSAGE_ERROR_CHARACTER': '',
'MESSAGE_INFORM_CHARACTER': 'i',
'MESSAGE_QUESTION_CHARACTER': '?',
'MESSAGE_SUCCESS_CHARACTER': '/',
'MESSAGE_WARNING_CHARACTER': '!',
'SUB_SUB_TITLE_WALL_CHARACTER': '*',
'SUB_TITLE_WALL_CHARACTER': '',
'TITLE_WALL_CHARACTER': '',
'TREE_COLUMN_SEPERATOR_CHAR': '│',
'TREE_LINE_SEPERATOR_CHAR': '─',
'TREE_NODE_CHAR': '├',
'TREE_NODE_END_CHAR': '└',
'MESSAGE_ANIMATION_DELAY_BLOCKY': 0.01,
'MESSAGE_ANIMATION_DELAY': 0.01
}

SAVE_TO_FILE = False
FILE_NAME = "run_results.txt"
FILE_DESCRIPTOR = None


IDTTY = DisplayTTY(
TOML_CONF,
SAVE_TO_FILE,
FILE_NAME,
)


Calling the tree function

The generic function is:

py
tree(self, title: str, data: list[str], offset: int = 0)


The output is: None

py
TEST_DATA = {
"test_data1": "test_data1.1",
"test_data2": "test_data2.1",
"test_data3": [
"test_data_list3.1",
"test_data_list3.2",
"test_data_list3.3",
"test_data_list3.4",
"test_data_list3.5"
],
"test_data4": "test_data4.1",
"test_data5": {
"test_data5.1": "test_data5.1.1",
"test_data5.2": "test_data5.2.1",
"test_data5.3": "test_data5.3.1",
"test_data5.4": "test_data5.4.1"
},
"test_data6": [
{
"test_data6.1": "test_data6.1.1",
"test_data6.2": "test_data6.2.1"
},
[
"test_data_list6.3.1",
"test_data_list6.3.1",
"test_data_list6.3.1",
"test_data_list6.3.1"
]
],
"test_data7": {
"test_data7.1": {
"test_data7.1.1": "test_data7.1.1.1",
"test_data7.1.2": "test_data7.1.2.1"
},
"test_data7.2": [
"test_data7.2.1",
"test_data7.2.2",
"test_data7.2.3",
"test_data7.2.4",
"test_data7.2.5"
]
}
}

IDTTY.tree("This is a test tree", TEST_DATA, 0)


Displaying a beautified Hello World

Hello World as a title

The generic function to display `Hello World!` as a title is:

py
title(self, title)


The outputs is: None

py
IDTTY.title("Hello World !")


Hello World as a sub title

The generic function to display `Hello World!` as a sub title is:

py
sub_title(self, sub_title)


The outputs is: None

py
IDTTY.sub_title("Hello World !")


Hello World as a sub sub title

The generic function to display `Hello World!` as a sub sub title is:

py
sub_sub_title(self, sub_sub_title)


The outputs is: None

py
IDTTY.sub_sub_title("Hello World !")


Hello World as a message with adjustable delay per call

The generic function to display `Hello World!` as a message is:

py
animate_message(self, message: str = "Hello World!", delay: float = 0.02)


The outputs is: None

py

1.0.0

An easy way to display the version is:

py
import display_tty as IDTTY
print(f"Version : {IDTTY.__Version__}")



pre-v1.0.0
This means the program has not been run throught the different tests occuring during the deployement of the versions.
This file was manually compiled and was released without being tested, use at your own risk.
The file size of 0.01 MB, this is a very lightweight library.
This library only relies on native python dependencies

The installers are:
- rdisp-1.0.0.tar.gz
- rdisp-1.0.0-py3-none-any.whl

The library name will remain `disp`.

0.01

IDTTY.tree_node_char string (length 1): i.e.: '├'
IDTTY.tree_node_end_char string (length 1): i.e.: '└'
IDTTY.tree_line_seperator_char string (length 1): i.e.: '─'
IDTTY.tree_column_seperator_char string (length 1): i.e.: '│'
IDTTY.save_to_file True or False
IDTTY.toml_content["PRETTIFY_OUTPUT"] True of False
IDTTY.toml_content["PRETTY_OUTPUT_IN_BLOCS"] True of False


To update a variable, simply assing it a new value, like in this example: `IDTTY.title_wall_chr = "&"`

PS: These changes only apply to the class you loaded, any others will not be touched.

Author

This module was written by (c) Henry Letellier
Attributions are appreciated.

Quick way:

py
print(f"AskQuestion is written by {IDTTY.author}")


Version

Links

Releases

Has known vulnerabilities

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.