<!--
-- +==== BEGIN display_tty =================+
-- LOGO:
-- ..@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
-- .@...........................#@
-- @############################.@
-- @...........................@.@
-- @..#######################..@.@
-- @.#########################.@.@
-- @.##>_#####################.@.@
-- @.#########################.@.@
-- @.#########################.@.@
-- @.#########################.@.@
-- @.#########################.@.@
-- @..#######################..@.@
-- @...........................@.@
-- @..+----+______________.....@.@
-- @..+....+______________+....@.@
-- @..+----+...................@.@
-- @...........................@.#
-- @@@@@@@@@@@@@@@@@@@@@@@@@@@@@#.
-- /STOP
-- PROJECT: display_tty
-- FILE: README.md
-- CREATION DATE: 06-11-2025
-- LAST Modified: 12:42:25 06-11-2025
-- DESCRIPTION:
-- A module that allows you to display text with a few boilers (i.e. put your text in a square for titles). It also allows to log to the terminal by wrapping around the logging library.
-- /STOP
-- COPYRIGHT: (c) Henry Letellier
-- PURPOSE: The reamde file in charge of explaining how to use the module.
-- // AR
-- +==== END display_tty =================+
-->
# Display tty












[](https://www.buymeacoffee.com/hanra)
## Take a look
This project now has automated documentation that gets generated, this manually written one will remain for legacy reasons, but you can now take a look at the automatic documentation here: [https://hanra-s-work.github.io/display_tty/](https://hanra-s-work.github.io/display_tty/)
## 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)
11. [Displaying a message in a box](#displaying-a-message-in-a-box)
12. [Displaying a rounded message box](#displaying-a-rounded-message-box)
13. [Displaying a vertical message box](#displaying-a-vertical-message-box)
14. [Displaying a box with different side and top characters](#displaying-a-box-with-different-side-and-top-characters)
15. [Displaying a box without vertical bars](#displaying-a-box-without-vertical-bars)
16. [Displaying a vertical box without horizontal bars](#displaying-a-vertical-box-without-horizontal-bars)
7. [Additional features (recent additions)](#additional-features-recent-additions)
1. [Logger integration / convenience initialiser](#logger-integration--convenience-initialiser)
2. [Custom log levels](#custom-log-levels)
3. [Update log colours](#update-log-colours)
4. [Output modes and file/string output](#output-modes-and-filestring-output)
5. [Runtime tweaks](#runtime-tweaks)
8. [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)
9. [Author](#author)
10. [Version](#version)
## Installation
### Using pip
```sh
pip install -U display-tty
```
### 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 (If we use the Pre-initialised class instance):
```py
IDTTY.title("Hello World !")
```
#### Hello World as a sub title
The generic function to display `Hello World!` as a sub title is (If we use the Pre-initialised class instance):
```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 (If we use the Pre-initialised class instance):
```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 (If we use the Pre-initialised class instance):
```py
IDTTY.animate_message("Hello World !", 0.01)
```
#### Hello World as a message
The generic function to display `Hello World!` as a message is (If we use the Pre-initialised class instance):
```py
IDTTY.message("Hello World !")
```
#### Hello World as a question message
The generic function to display `Hello World!` as a question message is (If we use the Pre-initialised class instance):
```py
IDTTY.question_message("Hello World !")
```
#### Hello World as an error message
The generic function to display `Hello World!` as an error message is (If we use the Pre-initialised class instance):
```py
IDTTY.error_message("Hello World !")
```
#### Hello World as a success message
The generic function to display `Hello World!` as a success message is (If we use the Pre-initialised class instance):
```py
IDTTY.success_message("Hello World !")
```
#### Hello World as a warning message
The generic function to display `Hello World!` as a warning message is (If we use the Pre-initialised class instance):
```py
IDTTY.warning_message("Hello World !")
```
#### Hello World as an inform message
The generic function to display `Hello World!` as an inform message is (If we use the Pre-initialised class instance):
```py
IDTTY.inform_message("Hello World !")
```
### Displaying a message in a box
The generic function to display `Hello World!` as a message in a box is (If we use the Pre-initialised class instance):
```py
IDTTY.disp_message_box("Hello World!", "#")
```
### Displaying a rounded message box
The generic function to display `Hello World!` in a rounded message box is (If we use the Pre-initialised class instance):
```py
IDTTY.disp_round_message_box("Hello World!")
```
### Displaying a vertical message box
The generic function to display `Hello World!` in a vertical message box is (If we use the Pre-initialised class instance):
```py
IDTTY.disp_vertical_message_box("Hello World!")
```
### Displaying the current date
The generic function to display the current date as a title is (If we use the Pre-initialised class instance):
```py
IDTTY.inform_message("Hello World !")
```
### Displaying a box with different side and top characters
The generic function to display a message in a box made of different characters is (If we use the Pre-initialised class instance):
```py
IDTTY.disp_diff_side_and_top_message_box("Hello World!")
```
### Displaying a box without vertical bars
The generic function to display a message in a box without vertical bars is (If we use the Pre-initialised class instance):
```py
IDTTY.disp_box_no_vertical("Hello World!")
```
### Displaying a vertical box without horizontal bars
The generic function to display a message in a box without horizontal bars is (If we use the Pre-initialised class instance):
```py
IDTTY.box_vertical_no_horizontal("Hello World!")
```
## Additional features (recent additions)
Since the last README update, a few logging and output features were added. They keep full backward compatibility but make integration and testing easier — short summary and examples below.
### Logger integration / convenience initialiser
Use `initialise_logger` from `display_tty` to create a `Disp` bound to an existing logger (or a name):
```py
from display_tty import initialise_logger
# returns a Disp instance using the calling module name as logger label
DI = initialise_logger(__name__, debug=True)
DI.log_info("This is an informational message")
DI.disp_print_debug("This is a debug message")
```
### Custom log levels
You can add custom logging levels at runtime and the library will create helper functions for both logging and display:
```py
# add a new level with integer value 45 and name 'DARLING'
DI.add_custom_level(45, 'DARLING', colour_text='purple', colour_bg='black')
# call the generated helpers
DI.log_darling("Message using the custom log level")
DI.disp_print_darling("Display helper for the same level")
```
### Update log colours
If you use colored logging (the default handler uses `colorlog`) you can change the text or background colour for any level at runtime:
```py
# change text colour for INFO and background for WARNING
DI.update_logging_colour_text('cyan', 'INFO')
DI.update_logging_colour_background('yellow', 'WARNING')
```
### Output modes and file/string output
The package supports different output modes via `display_tty.TOML_CONF`:
- `OUT_TTY` (default) — print to terminal
- `OUT_STRING` — capture output into an internal buffer (use `get_generated_content()` to fetch it)
- `OUT_FILE` — write output to a file (the class will open the file when configured)
Example: capture a message as a string:
```py
from display_tty import TOML_CONF, OUT_STRING
cfg = dict(TOML_CONF)
cfg['OUTPUT_MODE'] = OUT_STRING
DI = initialise_logger(__name__, toml_content=cfg)
DI.message('Hello captured')
content = DI.get_generated_content()
print('Captured:', repr(content))
```
### Runtime tweaks
A few small runtime helpers were added:
- `update_disp_debug(bool)` — toggle the `Disp` instance debug mode at runtime.
- `update_logger_level(level)` — update the active logger level for the instance (accepts numeric or named level).
Example:
```py
DI.update_disp_debug(True)
DI.update_logger_level('DEBUG')
```
These additions are backwards compatible: high-level calls such as `title`, `message`, `success_message` etc. continue to work while the new logging and output modes give more control for integrations and automated tests.
## Change the initialisation content
When initialising the class it is possible to change the animation behaviour by editing the `TOML_CONF` that you must provide when initialising the class.
During the initialisation it is also possible to redirect the output to a file instead of displaying it on the terminal. For this, please set the `save_to_file` to `True` and either:
- provide a file name in `file_name`
- provide a file descriptor in `file_descriptor`
If you provided a `file_name`, the file will automatically be opened
However, in both cases, you will need to close the file by calling the function `close_file` (i.e. at the end of your program)
### TOML configuration breakdown
This is the arguments that are required in the `TOML` file:
```txt #toml
1 | PRETTIFY_OUTPUT: True,
2 | PRETTY_OUTPUT_IN_BLOCS: True,
3 | MESSAGE_CHARACTER: '@',
4 | MESSAGE_ERROR_CHARACTER: '#',
5 | MESSAGE_INFORM_CHARACTER: '!',
6 | MESSAGE_QUESTION_CHARACTER: '?',
7 | MESSAGE_SUCCESS_CHARACTER: '/',
8 | MESSAGE_WARNING_CHARACTER: '?',
9 | SUB_SUB_TITLE_WALL_CHARACTER: '*',
10 | SUB_TITLE_WALL_CHARACTER: '@',
11 | TITLE_WALL_CHARACTER: '#',
12 | TREE_COLUMN_SEPERATOR_CHAR: '│',
13 | TREE_LINE_SEPERATOR_CHAR: '─',
14 | TREE_NODE_CHAR: '├',
15 | TREE_NODE_END_CHAR: '└',
16 | MESSAGE_ANIMATION_DELAY_BLOCKY: 0.01,
17 | MESSAGE_ANIMATION_DELAY: 0.01
```
PS: I've added line numbers `<number> |` to help you track the analysis of the file, these are generally added automatically by your code editor.
Thats a big file, lets break it down together:
#### line 1
```txt #toml
PRETTIFY_OUTPUT: True
```
This option is a crucial pivot for the program.
If:
- `True`: The program will output the content letter by letter while waiting a specified delay
- `False`: It will print out all of your messages at once without waiting any delay
#### line 2
```txt #toml
PRETTY_OUTPUT_IN_BLOCS: True
```
This option is an optimisation for the program.
If:
- `True`: The program will:
- Extract the words from the input
- output the content word by word while waiting a specified delay and respecting spacing
- `False`: It will print out all of your messages at once without waiting any delay
#### line 3
```txt #toml
MESSAGE_CHARACTER: '@'
```
This is a customisation, it allows you to specify the characther to use when displaying a message.
#### line 4
```txt #toml
MESSAGE_ERROR_CHARACTER: '#'
```
This is a customisation, it allows you to specify the characther to use when displaying an error message.
#### line 5
```txt #toml
MESSAGE_INFORM_CHARACTER: '!'
```
This is a customisation, it allows you to specify the characther to use when displaying an inform message.
#### line 6
```txt #toml
MESSAGE_QUESTION_CHARACTER: '?'
```
This is a customisation, it allows you to specify the characther to use when displaying a question message.
#### line 7
```txt #toml
MESSAGE_SUCCESS_CHARACTER: '/'
```
This is a customisation, it allows you to specify the characther to use when displaying a success message.
#### line 8
```txt #toml
MESSAGE_WARNING_CHARACTER: '?'
```
This is a customisation, it allows you to specify the characther to use when displaying a warning message.
#### line 9
```txt #toml
SUB_SUB_TITLE_WALL_CHARACTER: '*'
```
This is a customisation, it allows you to specify the characther to use when displaying a sub sub title.
#### line 10
```txt #toml
SUB_TITLE_WALL_CHARACTER: '@'
```
This is a customisation, it allows you to specify the characther to use when displaying a sub title.
#### line 11
```txt #toml
TITLE_WALL_CHARACTER: '#'
```
This is a customisation, it allows you to specify the characther to use when displaying a title.
#### line 12
```txt #toml
TREE_COLUMN_SEPERATOR_CHAR: '│'
```
This is the character used by the tree function to indicate the indentation level
i.e:
```txt
│ ├─── my_file
```
#### line 13
```txt #toml
TREE_LINE_SEPERATOR_CHAR: '─'
```
This is the character used by the tree function to indicate the file/folder of the current line
i.e:
```txt
├─── my_file
```
#### line 14
```txt #toml
TREE_NODE_CHAR: '├'
```
This is the character used by the tree function to indicate the directory level to wich the file/directory is linked but that this is not the last file/directory.
i.e:
```txt
├─── my_file
```
#### line 15
```txt #toml
TREE_NODE_END_CHAR: '└'
```
This is the character used by the tree function to indicate the directory level to wich the file/directory is linked but that this is the last file/directory.
i.e:
```txt
└─── my_file
```
#### line 16
```txt #toml
MESSAGE_ANIMATION_DELAY_BLOCKY: 0.01
```
Specify the delay between each word placement. (min: 0)
PS: if you enter 0, this is like setting `PRETTY_OUTPUT_IN_BLOCS` to `False`
#### line 17
```txt #toml
MESSAGE_ANIMATION_DELAY: 0.01
```
This variable is a pivot point for the program.
Specify the delay between each word placement. (min: 0)
PS: if you enter 0, this is like setting `PRETTY_OUTPUT_IN_BLOCS` to `False`
### Update the configuration of an initialised class
If the default initialisation, or the class you previously initialised has some elements you would like to update, you can do so by calling the inner variables.
Here are the variables you might be interested in:
```py
from display_tty import IDTTY
IDTTY.title_wall_chr # string (length 1): i.e.: '#'
IDTTY.sub_title_wall_chr # string (length 1): i.e.: '@'
IDTTY.sub_sub_title_wall_chr # string (length 1): i.e.: '*'
IDTTY.message_char # string (length 1): i.e.: '@'
IDTTY.message_error_char # string (length 1): i.e.: '#'
IDTTY.message_success_char # string (length 1): i.e.: '/'
IDTTY.message_inform_char # string (length 1): i.e.: 'i'
IDTTY.message_warning_char # string (length 1): i.e.: '!'
IDTTY.message_question_char # string (length 1): i.e.: '?'
IDTTY.message_animation_delay # float: i.e.: # 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
The current version is 1.0.0
An easy way to display the version is:
```py
import display_tty as IDTTY
print(f"Version : {IDTTY.__Version__}")
```
Raw data
{
"_id": null,
"home_page": "https://github.com/Hanra-s-work/display_tty",
"name": "display-tty",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.9",
"maintainer_email": "Henry Letellier <henrysoftwarehouse@protonmail.com>",
"keywords": "logger, terminal, logging, lightweight, colour, stdout, stderr, optimised, wrapper, pure python, python",
"author": "Henry Letellier",
"author_email": "Henry Letellier <henrysoftwarehouse@protonmail.com>",
"download_url": "https://files.pythonhosted.org/packages/b1/bd/cc32f1bc17fe9941bee23f291e8cb2c359932904b978bf9eccaac1e1eba2/display_tty-1.1.14.tar.gz",
"platform": null,
"description": "<!-- \n-- +==== BEGIN display_tty =================+\n-- LOGO: \n-- ..@@@@@@@@@@@@@@@@@@@@@@@@@@@@@\n-- .@...........................#@\n-- @############################.@\n-- @...........................@.@\n-- @..#######################..@.@\n-- @.#########################.@.@\n-- @.##>_#####################.@.@\n-- @.#########################.@.@\n-- @.#########################.@.@\n-- @.#########################.@.@\n-- @.#########################.@.@\n-- @..#######################..@.@\n-- @...........................@.@\n-- @..+----+______________.....@.@\n-- @..+....+______________+....@.@\n-- @..+----+...................@.@\n-- @...........................@.#\n-- @@@@@@@@@@@@@@@@@@@@@@@@@@@@@#.\n-- /STOP\n-- PROJECT: display_tty\n-- FILE: README.md\n-- CREATION DATE: 06-11-2025\n-- LAST Modified: 12:42:25 06-11-2025\n-- DESCRIPTION: \n-- A module that allows you to display text with a few boilers (i.e. put your text in a square for titles). It also allows to log to the terminal by wrapping around the logging library.\n-- /STOP\n-- COPYRIGHT: (c) Henry Letellier\n-- PURPOSE: The reamde file in charge of explaining how to use the module.\n-- // AR\n-- +==== END display_tty =================+\n-->\n# Display tty\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n[](https://www.buymeacoffee.com/hanra)\n\n## Take a look\n\nThis project now has automated documentation that gets generated, this manually written one will remain for legacy reasons, but you can now take a look at the automatic documentation here: [https://hanra-s-work.github.io/display_tty/](https://hanra-s-work.github.io/display_tty/)\n\n## Description\n\nThis is a python package I created in order to simplify the boiling process for displaying text in a geometrical shape drawn using characters.\n\n## Disclaimer\n\nThe 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.\n\nThe class will still remain `Disp` but bindings named `Display`, `DispTTY` and `DisplayTTY` are available.\n\nThe Preloaded version exists under: `IDISP`, `IDISPLAY`, `IDTTY` and `IDISPTTY`\n\n## Table of Content\n\n1. [Display tty](#display-tty)\n2. [Description](#description)\n3. [Disclaimer](#disclaimer)\n4. [Table of Content](#table-of-content)\n5. [Installation](#installation)\n 1. [Using pip](#using-pip)\n 2. [Using python](#using-python)\n6. [Usage](#usage)\n 1. [Importing](#importing)\n 2. [Initialising](#initialising)\n 3. [Calling the tree function](#calling-the-tree-function)\n 4. [Displaying a beautified Hello World](#displaying-a-beautified-hello-world)\n 1. [Hello World as a title](#hello-world-as-a-title)\n 2. [Hello World as a sub title](#hello-world-as-a-sub-title)\n 3. [Hello World as a sub sub title](#hello-world-as-a-sub-sub-title)\n 4. [Hello World as a message with adjustable delay per call](#hello-world-as-a-message-with-adjustable-delay-per-call)\n 5. [Hello World as a message](#hello-world-as-a-message)\n 6. [Hello World as a question message](#hello-world-as-a-question-message)\n 7. [Hello World as an error message](#hello-world-as-an-error-message)\n 8. [Hello World as a success message](#hello-world-as-a-success-message)\n 9. [Hello World as a warning message](#hello-world-as-a-warning-message)\n 10. [Hello World as an inform message](#hello-world-as-an-inform-message)\n 11. [Displaying a message in a box](#displaying-a-message-in-a-box)\n 12. [Displaying a rounded message box](#displaying-a-rounded-message-box)\n 13. [Displaying a vertical message box](#displaying-a-vertical-message-box)\n 14. [Displaying a box with different side and top characters](#displaying-a-box-with-different-side-and-top-characters)\n 15. [Displaying a box without vertical bars](#displaying-a-box-without-vertical-bars)\n 16. [Displaying a vertical box without horizontal bars](#displaying-a-vertical-box-without-horizontal-bars)\n7. [Additional features (recent additions)](#additional-features-recent-additions)\n 1. [Logger integration / convenience initialiser](#logger-integration--convenience-initialiser)\n 2. [Custom log levels](#custom-log-levels)\n 3. [Update log colours](#update-log-colours)\n 4. [Output modes and file/string output](#output-modes-and-filestring-output)\n 5. [Runtime tweaks](#runtime-tweaks)\n8. [Change the initialisation content](#change-the-initialisation-content)\n 1. [TOML configuration breakdown](#toml-configuration-breakdown)\n 1. [line 1](#line-1)\n 2. [line 2](#line-2)\n 3. [line 3](#line-3)\n 4. [line 4](#line-4)\n 5. [line 5](#line-5)\n 6. [line 6](#line-6)\n 7. [line 7](#line-7)\n 8. [line 8](#line-8)\n 9. [line 9](#line-9)\n 10. [line 10](#line-10)\n 11. [line 11](#line-11)\n 12. [line 12](#line-12)\n 13. [line 13](#line-13)\n 14. [line 14](#line-14)\n 15. [line 15](#line-15)\n 16. [line 16](#line-16)\n 17. [line 17](#line-17)\n 2. [Update the configuration of an initialised class](#update-the-configuration-of-an-initialised-class)\n9. [Author](#author)\n10. [Version](#version)\n\n## Installation\n\n### Using pip\n\n```sh\npip install -U display-tty\n```\n\n### Using python\n\nUnder Windows:\n\n```bat\npy -m pip install -U display-tty\n```\n\nUnder Linux/Mac OS:\n\n```sh\npython3 -m pip install -U display-tty\n```\n\n## Usage\n\n### Importing\n\n```py\nfrom display_tty import IDTTY\n```\n\n### Initialising\n\nThe generic class is: `Disp(toml_content: dict, save_to_file: bool = False, file_name: str = \"text_output_run.txt\", file_descriptor: any = None)`\n\nFor your convenience, you can use the `IDTTY` variable which is an initialised version of the class.\n\n```py\nIDTTY.title(\"Hello World\")\n```\n\nOtherwise, if you wish to initialise the class with your own parameters, you can do so like this:\n\n```py\nfrom display_tty import DisplayTTY\nTOML_CONF = {\n 'PRETTIFY_OUTPUT': True,\n 'PRETTY_OUTPUT_IN_BLOCS': True,\n 'MESSAGE_CHARACTER': '@',\n 'MESSAGE_ERROR_CHARACTER': '#',\n 'MESSAGE_INFORM_CHARACTER': 'i',\n 'MESSAGE_QUESTION_CHARACTER': '?',\n 'MESSAGE_SUCCESS_CHARACTER': '/',\n 'MESSAGE_WARNING_CHARACTER': '!',\n 'SUB_SUB_TITLE_WALL_CHARACTER': '*',\n 'SUB_TITLE_WALL_CHARACTER': '@',\n 'TITLE_WALL_CHARACTER': '#',\n 'TREE_COLUMN_SEPERATOR_CHAR': '\u2502',\n 'TREE_LINE_SEPERATOR_CHAR': '\u2500',\n 'TREE_NODE_CHAR': '\u251c',\n 'TREE_NODE_END_CHAR': '\u2514',\n 'MESSAGE_ANIMATION_DELAY_BLOCKY': 0.01,\n 'MESSAGE_ANIMATION_DELAY': 0.01\n}\n\nSAVE_TO_FILE = False\nFILE_NAME = \"run_results.txt\"\nFILE_DESCRIPTOR = None\n\n\nIDTTY = DisplayTTY(\n TOML_CONF,\n SAVE_TO_FILE,\n FILE_NAME,\n)\n```\n\n### Calling the tree function\n\nThe generic function is:\n\n```py\ntree(self, title: str, data: list[str], offset: int = 0)\n```\n\nThe output is: None\n\n```py\nTEST_DATA = {\n \"test_data1\": \"test_data1.1\",\n \"test_data2\": \"test_data2.1\",\n \"test_data3\": [\n \"test_data_list3.1\",\n \"test_data_list3.2\",\n \"test_data_list3.3\",\n \"test_data_list3.4\",\n \"test_data_list3.5\"\n ],\n \"test_data4\": \"test_data4.1\",\n \"test_data5\": {\n \"test_data5.1\": \"test_data5.1.1\",\n \"test_data5.2\": \"test_data5.2.1\",\n \"test_data5.3\": \"test_data5.3.1\",\n \"test_data5.4\": \"test_data5.4.1\"\n },\n \"test_data6\": [\n {\n \"test_data6.1\": \"test_data6.1.1\",\n \"test_data6.2\": \"test_data6.2.1\"\n },\n [\n \"test_data_list6.3.1\",\n \"test_data_list6.3.1\",\n \"test_data_list6.3.1\",\n \"test_data_list6.3.1\"\n ]\n ],\n \"test_data7\": {\n \"test_data7.1\": {\n \"test_data7.1.1\": \"test_data7.1.1.1\",\n \"test_data7.1.2\": \"test_data7.1.2.1\"\n },\n \"test_data7.2\": [\n \"test_data7.2.1\",\n \"test_data7.2.2\",\n \"test_data7.2.3\",\n \"test_data7.2.4\",\n \"test_data7.2.5\"\n ]\n }\n}\n\nIDTTY.tree(\"This is a test tree\", TEST_DATA, 0)\n```\n\n### Displaying a beautified Hello World\n\n#### Hello World as a title\n\nThe generic function to display `Hello World!` as a title is (If we use the Pre-initialised class instance):\n\n```py\nIDTTY.title(\"Hello World !\")\n```\n\n#### Hello World as a sub title\n\nThe generic function to display `Hello World!` as a sub title is (If we use the Pre-initialised class instance):\n\n```py\nIDTTY.sub_title(\"Hello World !\")\n```\n\n#### Hello World as a sub sub title\n\nThe generic function to display `Hello World!` as a sub sub title is (If we use the Pre-initialised class instance):\n\n```py\nIDTTY.sub_sub_title(\"Hello World !\")\n```\n\n#### Hello World as a message with adjustable delay per call\n\nThe generic function to display `Hello World!` as a message is (If we use the Pre-initialised class instance):\n\n```py\nIDTTY.animate_message(\"Hello World !\", 0.01)\n```\n\n#### Hello World as a message\n\nThe generic function to display `Hello World!` as a message is (If we use the Pre-initialised class instance):\n\n```py\nIDTTY.message(\"Hello World !\")\n```\n\n#### Hello World as a question message\n\nThe generic function to display `Hello World!` as a question message is (If we use the Pre-initialised class instance):\n\n```py\nIDTTY.question_message(\"Hello World !\")\n```\n\n#### Hello World as an error message\n\nThe generic function to display `Hello World!` as an error message is (If we use the Pre-initialised class instance):\n\n```py\nIDTTY.error_message(\"Hello World !\")\n```\n\n#### Hello World as a success message\n\nThe generic function to display `Hello World!` as a success message is (If we use the Pre-initialised class instance):\n\n```py\nIDTTY.success_message(\"Hello World !\")\n```\n\n#### Hello World as a warning message\n\nThe generic function to display `Hello World!` as a warning message is (If we use the Pre-initialised class instance):\n\n```py\nIDTTY.warning_message(\"Hello World !\")\n```\n\n#### Hello World as an inform message\n\nThe generic function to display `Hello World!` as an inform message is (If we use the Pre-initialised class instance):\n\n```py\nIDTTY.inform_message(\"Hello World !\")\n```\n\n### Displaying a message in a box\n\nThe generic function to display `Hello World!` as a message in a box is (If we use the Pre-initialised class instance):\n\n```py\nIDTTY.disp_message_box(\"Hello World!\", \"#\")\n```\n\n### Displaying a rounded message box\n\nThe generic function to display `Hello World!` in a rounded message box is (If we use the Pre-initialised class instance):\n\n```py\nIDTTY.disp_round_message_box(\"Hello World!\")\n```\n\n### Displaying a vertical message box\n\nThe generic function to display `Hello World!` in a vertical message box is (If we use the Pre-initialised class instance):\n\n```py\nIDTTY.disp_vertical_message_box(\"Hello World!\")\n```\n\n### Displaying the current date\n\nThe generic function to display the current date as a title is (If we use the Pre-initialised class instance):\n\n```py\nIDTTY.inform_message(\"Hello World !\")\n```\n\n### Displaying a box with different side and top characters\n\nThe generic function to display a message in a box made of different characters is (If we use the Pre-initialised class instance):\n\n```py\nIDTTY.disp_diff_side_and_top_message_box(\"Hello World!\")\n```\n\n### Displaying a box without vertical bars\n\nThe generic function to display a message in a box without vertical bars is (If we use the Pre-initialised class instance):\n\n```py\nIDTTY.disp_box_no_vertical(\"Hello World!\")\n```\n\n### Displaying a vertical box without horizontal bars\n\nThe generic function to display a message in a box without horizontal bars is (If we use the Pre-initialised class instance):\n\n```py\nIDTTY.box_vertical_no_horizontal(\"Hello World!\")\n```\n\n## Additional features (recent additions)\n\nSince the last README update, a few logging and output features were added. They keep full backward compatibility but make integration and testing easier \u2014 short summary and examples below.\n\n### Logger integration / convenience initialiser\n\nUse `initialise_logger` from `display_tty` to create a `Disp` bound to an existing logger (or a name):\n\n```py\nfrom display_tty import initialise_logger\n\n# returns a Disp instance using the calling module name as logger label\nDI = initialise_logger(__name__, debug=True)\n\nDI.log_info(\"This is an informational message\")\nDI.disp_print_debug(\"This is a debug message\")\n```\n\n### Custom log levels\n\nYou can add custom logging levels at runtime and the library will create helper functions for both logging and display:\n\n```py\n# add a new level with integer value 45 and name 'DARLING'\nDI.add_custom_level(45, 'DARLING', colour_text='purple', colour_bg='black')\n\n# call the generated helpers\nDI.log_darling(\"Message using the custom log level\")\nDI.disp_print_darling(\"Display helper for the same level\")\n```\n\n### Update log colours\n\nIf you use colored logging (the default handler uses `colorlog`) you can change the text or background colour for any level at runtime:\n\n```py\n# change text colour for INFO and background for WARNING\nDI.update_logging_colour_text('cyan', 'INFO')\nDI.update_logging_colour_background('yellow', 'WARNING')\n```\n\n### Output modes and file/string output\n\nThe package supports different output modes via `display_tty.TOML_CONF`:\n\n- `OUT_TTY` (default) \u2014 print to terminal\n- `OUT_STRING` \u2014 capture output into an internal buffer (use `get_generated_content()` to fetch it)\n- `OUT_FILE` \u2014 write output to a file (the class will open the file when configured)\n\nExample: capture a message as a string:\n\n```py\nfrom display_tty import TOML_CONF, OUT_STRING\ncfg = dict(TOML_CONF)\ncfg['OUTPUT_MODE'] = OUT_STRING\nDI = initialise_logger(__name__, toml_content=cfg)\nDI.message('Hello captured')\ncontent = DI.get_generated_content()\nprint('Captured:', repr(content))\n```\n\n### Runtime tweaks\n\nA few small runtime helpers were added:\n\n- `update_disp_debug(bool)` \u2014 toggle the `Disp` instance debug mode at runtime.\n- `update_logger_level(level)` \u2014 update the active logger level for the instance (accepts numeric or named level).\n\nExample:\n\n```py\nDI.update_disp_debug(True)\nDI.update_logger_level('DEBUG')\n```\n\nThese additions are backwards compatible: high-level calls such as `title`, `message`, `success_message` etc. continue to work while the new logging and output modes give more control for integrations and automated tests.\n\n## Change the initialisation content\n\nWhen initialising the class it is possible to change the animation behaviour by editing the `TOML_CONF` that you must provide when initialising the class.\n\nDuring the initialisation it is also possible to redirect the output to a file instead of displaying it on the terminal. For this, please set the `save_to_file` to `True` and either:\n\n- provide a file name in `file_name`\n\n- provide a file descriptor in `file_descriptor`\n\nIf you provided a `file_name`, the file will automatically be opened\nHowever, in both cases, you will need to close the file by calling the function `close_file` (i.e. at the end of your program)\n\n### TOML configuration breakdown\n\nThis is the arguments that are required in the `TOML` file:\n\n```txt #toml\n1 | PRETTIFY_OUTPUT: True,\n2 | PRETTY_OUTPUT_IN_BLOCS: True,\n3 | MESSAGE_CHARACTER: '@',\n4 | MESSAGE_ERROR_CHARACTER: '#',\n5 | MESSAGE_INFORM_CHARACTER: '!',\n6 | MESSAGE_QUESTION_CHARACTER: '?',\n7 | MESSAGE_SUCCESS_CHARACTER: '/',\n8 | MESSAGE_WARNING_CHARACTER: '?',\n9 | SUB_SUB_TITLE_WALL_CHARACTER: '*',\n10 | SUB_TITLE_WALL_CHARACTER: '@',\n11 | TITLE_WALL_CHARACTER: '#',\n12 | TREE_COLUMN_SEPERATOR_CHAR: '\u2502',\n13 | TREE_LINE_SEPERATOR_CHAR: '\u2500',\n14 | TREE_NODE_CHAR: '\u251c',\n15 | TREE_NODE_END_CHAR: '\u2514',\n16 | MESSAGE_ANIMATION_DELAY_BLOCKY: 0.01,\n17 | MESSAGE_ANIMATION_DELAY: 0.01\n```\n\nPS: I've added line numbers `<number> |` to help you track the analysis of the file, these are generally added automatically by your code editor.\n\nThats a big file, lets break it down together:\n\n#### line 1\n\n```txt #toml\nPRETTIFY_OUTPUT: True\n```\n\nThis option is a crucial pivot for the program.\n\nIf:\n\n- `True`: The program will output the content letter by letter while waiting a specified delay\n- `False`: It will print out all of your messages at once without waiting any delay\n\n#### line 2\n\n```txt #toml\nPRETTY_OUTPUT_IN_BLOCS: True\n```\n\nThis option is an optimisation for the program.\n\nIf:\n\n- `True`: The program will:\n - Extract the words from the input\n - output the content word by word while waiting a specified delay and respecting spacing\n- `False`: It will print out all of your messages at once without waiting any delay\n\n#### line 3\n\n```txt #toml\nMESSAGE_CHARACTER: '@'\n```\n\nThis is a customisation, it allows you to specify the characther to use when displaying a message.\n\n#### line 4\n\n```txt #toml\nMESSAGE_ERROR_CHARACTER: '#'\n```\n\nThis is a customisation, it allows you to specify the characther to use when displaying an error message.\n\n#### line 5\n\n```txt #toml\nMESSAGE_INFORM_CHARACTER: '!'\n```\n\nThis is a customisation, it allows you to specify the characther to use when displaying an inform message.\n\n#### line 6\n\n```txt #toml\nMESSAGE_QUESTION_CHARACTER: '?'\n```\n\nThis is a customisation, it allows you to specify the characther to use when displaying a question message.\n\n#### line 7\n\n```txt #toml\nMESSAGE_SUCCESS_CHARACTER: '/'\n```\n\nThis is a customisation, it allows you to specify the characther to use when displaying a success message.\n\n#### line 8\n\n```txt #toml\nMESSAGE_WARNING_CHARACTER: '?'\n```\n\nThis is a customisation, it allows you to specify the characther to use when displaying a warning message.\n\n#### line 9\n\n```txt #toml\nSUB_SUB_TITLE_WALL_CHARACTER: '*'\n```\n\nThis is a customisation, it allows you to specify the characther to use when displaying a sub sub title.\n\n#### line 10\n\n```txt #toml\nSUB_TITLE_WALL_CHARACTER: '@'\n```\n\nThis is a customisation, it allows you to specify the characther to use when displaying a sub title.\n\n#### line 11\n\n```txt #toml\nTITLE_WALL_CHARACTER: '#'\n```\n\nThis is a customisation, it allows you to specify the characther to use when displaying a title.\n\n#### line 12\n\n```txt #toml\nTREE_COLUMN_SEPERATOR_CHAR: '\u2502'\n```\n\nThis is the character used by the tree function to indicate the indentation level\n\ni.e:\n\n```txt\n\u2502 \u251c\u2500\u2500\u2500 my_file\n```\n\n#### line 13\n\n```txt #toml\nTREE_LINE_SEPERATOR_CHAR: '\u2500'\n```\n\nThis is the character used by the tree function to indicate the file/folder of the current line\n\ni.e:\n\n```txt\n\u251c\u2500\u2500\u2500 my_file\n```\n\n#### line 14\n\n```txt #toml\nTREE_NODE_CHAR: '\u251c'\n```\n\nThis is the character used by the tree function to indicate the directory level to wich the file/directory is linked but that this is not the last file/directory.\n\ni.e:\n\n```txt\n\u251c\u2500\u2500\u2500 my_file\n```\n\n#### line 15\n\n```txt #toml\nTREE_NODE_END_CHAR: '\u2514'\n```\n\nThis is the character used by the tree function to indicate the directory level to wich the file/directory is linked but that this is the last file/directory.\n\ni.e:\n\n```txt\n\u2514\u2500\u2500\u2500 my_file\n```\n\n#### line 16\n\n```txt #toml\nMESSAGE_ANIMATION_DELAY_BLOCKY: 0.01\n```\n\nSpecify the delay between each word placement. (min: 0)\n\nPS: if you enter 0, this is like setting `PRETTY_OUTPUT_IN_BLOCS` to `False`\n\n#### line 17\n\n```txt #toml\nMESSAGE_ANIMATION_DELAY: 0.01\n```\n\nThis variable is a pivot point for the program.\n\nSpecify the delay between each word placement. (min: 0)\n\nPS: if you enter 0, this is like setting `PRETTY_OUTPUT_IN_BLOCS` to `False`\n\n### Update the configuration of an initialised class\n\nIf the default initialisation, or the class you previously initialised has some elements you would like to update, you can do so by calling the inner variables.\n\nHere are the variables you might be interested in:\n\n```py\nfrom display_tty import IDTTY\nIDTTY.title_wall_chr # string (length 1): i.e.: '#'\nIDTTY.sub_title_wall_chr # string (length 1): i.e.: '@'\nIDTTY.sub_sub_title_wall_chr # string (length 1): i.e.: '*'\nIDTTY.message_char # string (length 1): i.e.: '@'\nIDTTY.message_error_char # string (length 1): i.e.: '#'\nIDTTY.message_success_char # string (length 1): i.e.: '/'\nIDTTY.message_inform_char # string (length 1): i.e.: 'i'\nIDTTY.message_warning_char # string (length 1): i.e.: '!'\nIDTTY.message_question_char # string (length 1): i.e.: '?'\nIDTTY.message_animation_delay # float: i.e.: # 0.01\nIDTTY.tree_node_char # string (length 1): i.e.: '\u251c'\nIDTTY.tree_node_end_char # string (length 1): i.e.: '\u2514'\nIDTTY.tree_line_seperator_char # string (length 1): i.e.: '\u2500'\nIDTTY.tree_column_seperator_char # string (length 1): i.e.: '\u2502'\nIDTTY.save_to_file # True or False\nIDTTY.toml_content[\"PRETTIFY_OUTPUT\"] # True of False\nIDTTY.toml_content[\"PRETTY_OUTPUT_IN_BLOCS\"] # True of False\n```\n\nTo update a variable, simply assing it a new value, like in this example: `IDTTY.title_wall_chr = \"&\"`\n\nPS: These changes only apply to the class you loaded, any others will not be touched.\n\n## Author\n\nThis module was written by (c) Henry Letellier\nAttributions are appreciated.\n\nQuick way:\n\n```py\nprint(f\"AskQuestion is written by {IDTTY.author}\")\n```\n\n## Version\n\nThe current version is 1.0.0\n\nAn easy way to display the version is:\n\n```py\nimport display_tty as IDTTY\nprint(f\"Version : {IDTTY.__Version__}\")\n```\n",
"bugtrack_url": null,
"license": null,
"summary": "A module that allows you to display text with a few boilers (i.e. put your text in a square for titles). It also allows to log to the terminal by wrapping around the logging library.",
"version": "1.1.14",
"project_urls": {
"Documentation": "https://github.com/Hanra-s-work/display_tty/blob/main/README.md",
"Homepage": "https://github.com/Hanra-s-work/display_tty",
"Issues": "https://github.com/Hanra-s-work/display_tty/issues",
"Repository": "https://github.com/Hanra-s-work/display_tty.git"
},
"split_keywords": [
"logger",
" terminal",
" logging",
" lightweight",
" colour",
" stdout",
" stderr",
" optimised",
" wrapper",
" pure python",
" python"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "48564997411d8b60219243153d670f1902fe2b6637edab5e7325136c89a9634e",
"md5": "24c62afa5b0bb51ad11ab37809489e0f",
"sha256": "0df954c77480dd436d45c6b6a9fbaabeba498f8c66caca41054bbea201e6898b"
},
"downloads": -1,
"filename": "display_tty-1.1.14-py3-none-any.whl",
"has_sig": false,
"md5_digest": "24c62afa5b0bb51ad11ab37809489e0f",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.9",
"size": 11744,
"upload_time": "2025-11-06T12:22:13",
"upload_time_iso_8601": "2025-11-06T12:22:13.799786Z",
"url": "https://files.pythonhosted.org/packages/48/56/4997411d8b60219243153d670f1902fe2b6637edab5e7325136c89a9634e/display_tty-1.1.14-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "b1bdcc32f1bc17fe9941bee23f291e8cb2c359932904b978bf9eccaac1e1eba2",
"md5": "14404950607f9976e460a65ae4ba626c",
"sha256": "e1eba015b935676a019ab83bd96f8ec8ad3bd58fa451cae4a440c48f79145027"
},
"downloads": -1,
"filename": "display_tty-1.1.14.tar.gz",
"has_sig": false,
"md5_digest": "14404950607f9976e460a65ae4ba626c",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.9",
"size": 22063,
"upload_time": "2025-11-06T12:22:14",
"upload_time_iso_8601": "2025-11-06T12:22:14.980117Z",
"url": "https://files.pythonhosted.org/packages/b1/bd/cc32f1bc17fe9941bee23f291e8cb2c359932904b978bf9eccaac1e1eba2/display_tty-1.1.14.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-11-06 12:22:14",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "Hanra-s-work",
"github_project": "display_tty",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [],
"lcname": "display-tty"
}