Skip to content

Instantly share code, notes, and snippets.

@justxor
Created April 20, 2022 07:12
Show Gist options
  • Save justxor/704d00b25f828158b1536ec48d3fad95 to your computer and use it in GitHub Desktop.
Save justxor/704d00b25f828158b1536ec48d3fad95 to your computer and use it in GitHub Desktop.
>>> Art=text2art("art") # Return ASCII text (default font) and default chr_ignore=True
>>> print(Art)
_
__ _ _ __ | |_
/ _` || '__|| __|
| (_| || | | |_
\__,_||_| \__|
>>> Art=text2art("art",font='block',chr_ignore=True) # Return ASCII text with block font
>>> print(Art)
.----------------. .----------------. .----------------.
| .--------------. || .--------------. || .--------------. |
| | __ | || | _______ | || | _________ | |
| | / \ | || | |_ __ \ | || | | _ _ | | |
| | / /\ \ | || | | |__) | | || | |_/ | | \_| | |
| | / ____ \ | || | | __ / | || | | | | |
| | _/ / \ \_ | || | _| | \ \_ | || | _| |_ | |
| ||____| |____|| || | |____| |___| | || | |_____| | |
| | | || | | || | | |
| '--------------' || '--------------' || '--------------' |
'----------------' '----------------' '----------------'
>>> Art=text2art("test","random") # random font mode
>>> print(Art)
| |
~|~/~/(~~|~
| \/__) |
>>> Art=text2art("test","rand") # random font mode
>>> print(Art)
___ ____ ____ ___
| |___ [__ |
| |___ ___] |
>>> print(text2art('''Lorem
ipsum
dolor''', font="small")) # Multi-line print
_
| | ___ _ _ ___ _ __
| |__ / _ \| '_|/ -_)| ' \
|____|\___/|_| \___||_|_|_|
_
(_) _ __ ___ _ _ _ __
| || '_ \(_-<| || || ' \
|_|| .__//__/ \_,_||_|_|_|
|_|
_ _
__| | ___ | | ___ _ _
/ _` |/ _ \| |/ _ \| '_|
\__,_|\___/|_|\___/|_|
>>> print(text2art("test","white_bubble")) # Non-ASCII font example
ⓣⓔⓢⓣ
>>> text2art("art",font="fancy5",decoration="barcode1") # decoration parameter is added in Version 4.6
'▌│█║▌║▌║ ᏗᏒᏖ ║▌║▌║█│▌'
>>> text2art("seسسس",font=DEFAULT_FONT,chr_ignore=False) # raise artError in exception
Traceback (most recent call last):
...
art.art.artError: س is invalid.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment