Fancy Print is a Python package that provides a replacement to the built-in print() function. It is designed to be aesthetically pleasing and easy to use.
Fancy Print is available on PyPI. You can install it using pip:
pip install fancyprintFancy Print provides a class called 'Printer' that can be used to replace the built-in print() function. It can be used as follows:
from fancyprint import Printer
printer = Printer()The Printer class has a configure_options() method that can be used to configure the options for the printer. We have a PrinterConfig type for configurations. It is to be passed to print() to modify the configurations for that statement. For Alignment there is an Enum [ Align.LEFT, Align.RIGHT, Align.CENTER ]. The options can be configured as follows:
printer.configure_options(PrinterConfig(delimiter_left="|", delimiter_right="|",
delimiter_left_color="cyan", delimiter_right_color="cyan", separator_back="-",
separator_front="-", separator_front_color="magenta", separator_back_color="magenta",
delimiter_space=2))The Printer class also has a print() method that can be used to print text. The print() method can be used as follows:
printer.print("This is some text in the center", PrinterConfig(align=Align.CENTER, blank_character=" ", left_delimiter=True, right_delimiter=True, back_separator=True,
front_separator=True))
# Example
printer.print("Hello World!", PrinterConfig(align=Align.CENTER, blank_character=" ", left_delimiter=True))