Terminalia provides a collection of useful functions for working with terminals, including:
Terminal.set_title(title: str)
: sets the title of the console window to the given title.Terminal.clear()
: clears the terminal screen.Terminal.hide_cursor()
: hides the cursor in the console.Terminal.show_cursor()
: shows the cursor in the console.Terminal.translate(text: str)
: translates the given text from English to another language.Terminal.write(text: str, interval: float = 0.01, hide_cursor: bool = True)
: simulates typing out the given text with a specified interval between characters.
pip3 install Terminalia
To use this package, simply import it as follows:
from Terminalia import Terminal, Color # importing color is optional
Sets the title of the terminal window.
from Terminalia import Terminal
Terminal.Title("This is a test title")
Args:
- title (str): The title to set for the terminal window.
Clears the terminal screen.
from Terminalia import Terminal
Terminal.Clear()
Hides the cursor on the terminal.
from Terminalia import Terminal
Terminal.Hide_Cursor()
Displays the cursor on the terminal.
from Terminalia import Terminal
Terminal.Show_Cursor()
Translate text from one language to another. Auto detects the specified text's language as well as the users language.
from Terminalia import Terminal
print(Terminal.Translate("Ceci est un exemple de texte"))
Args:
- text (str): The text to translate.
Returns:
- str: The translated text.
Writes the specified text to the console, one character at a time, with an optional delay between characters.
from Terminalia import Terminal
print(Terminal.Write(text="This is an example text", interval=0.5, hide_cursor=True))
Args:
- text (str): The text to write out.
- interval (float, optional): The delay between characters, in seconds. Default is 0.01 seconds.
- hide_cursor (bool, optional): Whether to hide the cursor while writing the text. Default is True.
Returns:
- str: The final typed out string.
Colors text with the specified color.
from Terminalia import Color
print(f"{Color.BLUE}Hello, world!{Color.RESET}")
Colors
- BLACK
- RED
- GREEN
- YELLOW
- BLUE
- PURPLE
- CYAN
- WHITE
- GREY
- BOLD
- UNDERLINE
- BG_BLACK
- BG_RED
- BG_GREEN
- BG_YELLOW
- BG_BLUE
- BG_MAGENTA
- BG_CYAN
- BG_WHITE
- BRIGHT_RED
- BRIGHT_GREEN
- BRIGHT_YELLOW
- BRIGHT_BLUE
- BRIGHT_PURPLE
- BRIGHT_CYAN
- BRIGHT_WHITE
- RESET
- Telegram: t.me/angell