0
Formating in python
I tried to add the code here it simply canât get complied since it neeeds to bee run from terminal py pycharm visual studio ,i can add it anyways as a file if it is needed later on But basically i made a board And used reset=â\033[0mâ BLUE=â\033[7;34mâ Empty=fâ{BLUE}*{reset}â So that for an empty element in a list i get color blue for background , Default black for text And reset at the end The board was printed nicely and all Yet i could not make the cells more thick to get somewhat comfy design
7 RĂ©ponses
+ 2
cli apps use fonts and special characters. You are limited by what is supported by the specific terminal you are running it on.
What fonts are available is also something to consider when designing the look of your interface. What works on your setup might not work elsewhere if the font, os and terminal is different.
some useful libraries:
termcolor
https://pypi.org/project/termcolor/
colorama
https://pypi.org/project/colorama/
blessings
https://pypi.org/project/blessings/
rich
https://pypi.org/project/rich/
for tables maybe use this:
prettytable
https://pypi.org/project/prettytable/
tabulate
https://pypi.org/project/tabulate/
+ 1
you can also use pandas to print tables in the terminal, but you also need to pip install tabulate
https://sololearn.com/compiler-playground/cblsOrK8ELIF/?ref=app
+ 1
Bob_Li i only knew that i can minupulate the command line interface on my part on the custmization level , i assumed whatever terminal had the default settings maybe with additional featuers , for fonts i kind of noticed that some terminals default to white text on black background , some to gray background , some to other text colors and background
But other than that i am under educated ,
I will leave this for a bit in order to maybe see additional intersting answers and read about the libraries you provied ,
thank you for your time and the resources you provied , very helpful as alwaysđ , will be surec to accept an answer soon
+ 1
ansi colors: copy paste the content as a python file so you have a reference for the ansi codes and what they look like when displayed.
https://gist.githubusercontent.com/rene-d/9e584a7dd2935d0f461904b9f2950007/raw/e2e58ccf955475d8066338a4e538c52debc06a06/colors.py
maybe for bold you need
BOLD = "\033[1m"
+ 1
just remember that not all ansii codes might be supported by your terminal.
0
you can use functions and classes to build your ansii codes
https://sololearn.com/compiler-playground/chN6NkY252uW/?ref=app
0
đđthank you this is a really gem mine