ASCII Art
Overview
The art.py
module provides a collection of ASCII art illustrations and utilities
for displaying or saving them. This documentation outlines the available ASCII art,
the dictionary structure, and how to use the print_art
function to interact with the artwork.
Features
A dictionary of predefined ASCII art.
Flexible options to display one, multiple, or all available ASCII art illustrations.
Capability to save the output to a specified file and directory.
ASCII Art Collection
The ascii_art
dictionary contains the following predefined artworks:
eda_toolkit_logo: ASCII representation of the EDA Toolkit logo.
leon_shpaner_bb: ASCII art of “Leon Shpaner” with a black background.
leon_shpaner_wb: ASCII art of “Leon Shpaner” with a white background.
oscar_gil_bb: ASCII art of “Oscar Gil” with a black background.
oscar_gil_wb: ASCII art of “Oscar Gil” with a white background.
royce_hall_bb: ASCII art of UCLA’s Royce Hall with a black background.
royce_hall_wb: ASCII art of UCLA’s Royce Hall with a white background.
ca_state_bb: ASCII art of the State of California with a black background.
ca_state_wb: ASCII art of the State of California with a white background.
- print_art(*art_names, all=False, output_file=None, output_path=None)
Print ASCII art based on user input and optionally save output to a specified path.
- Parameters:
art_names (str) – Names of the ASCII art to print. Each name should match a key in the
ascii_art
dictionary.all (bool, optional) – If
True
, all available ASCII art will be printed. Defaults toFalse
.output_file (str, optional) – Name of the file to save the output. Defaults to
.txt
if no extension is provided.output_path (str, optional) – Directory where the output file should be saved. If not specified, the current working directory will be used. Non-existent directories will be created automatically.
- Raises:
ValueError – If both
art_names
andall=True
are specified simultaneously.
Examples
Display a Logo Artwork:
from art import print_art
print_art("eda_toolkit_logo")
+--------------------------------------------------------------------------------+
| _____ ____ _ _____ _ _ _ _ |
| | ____| | _ \ / \ |_ _| ___ ___ | | | | __ (_) | |_ |
| | _| | | | | / _ \ _____ | | / _ \ / _ \ | | | |/ / | | | __| |
| | |___ | |_| | / ___ \ |_____| | | | (_) | | (_) | | | | < | | | |_ |
| |_____| |____/ /_/ \_\ |_| \___/ \___/ |_| |_|\_\ |_| \__| |
| |
+--------------------------------------------------------------------------------+
Display Leon Shpaner Image:
from art import print_art
print_art("leon_shpaner_wb")
Leon Shpaner
%%%%%%%%%%%%%%%
%%%%%%%%%%@%@@%%@@@@@@@
@@@@@@@%%%%%@%@%@@@@%%%@@@@
@@@@@@@@%%%%%%%%%%%%%%@@@@@@@%%
@@@@@@@@@@%%%%####*****#%@@@@@@@%%%
@@@@@%%%%####**+++++++++++*%@@%%%@%%@
@@@@%###****++++++++++++++++*%%%%@@%%@
@@@#*****++++++++++++++++++++#%%%%%%%%%
@@@##****++++++++++++++++++++++#%%%%%%%%
@@%####***+++++++++++++++++++++*%@%%%%%%
@@#####****+++++++++++++++++++***%@@%%%%%
@@####*****++++++++++++++++++++**#%@@%%%%
@@###****+++++++++++++++++++++++*#%@@%%%%
@@###*****+++++++++++++++++++++++*%@@@%%#+
@@##########****###%%%%%####**+++*#%%%###**
@@%%%%%@@%%%##*##%%%%##****#**++++#%%#++*#+
%%%%%%#%%%%%%#++*##%%%%@%##*++++++*###+++*+
%%##%%%%%%#%#*+++***#****++++++++++##***+*+
#%#####*****#*++++++++++++++++++++*##++++++
#%##**++++**#*++++++++++++++++++++*##+++++
####*+++++*##+++++++*+++++++++++++*##+++++
###*****##*++++++++**##***++++++*###+++*
%%###*####%##*##%##*+*#####**++*####*
%%#####%%%%%%%%%%%#####%##******#####
%%####%%%%%%%%%%%%%%#%%%%#*****######
%%###%%%@%%%######*####%##*#####%%#
%%%%#%%%#%###****++++*#########%%%*
%%%%%%#####*******++*######%%%%%#+*+
%%%%%%#######***+++*#%%%%%%%%%#*+#++
@@@@@@%##***+++++**#%%%%%%%%%#*++*=+###
@@@@@@%%##########%%@%%%%%%#*+++===+##%
@@@@@@@%%%%%%%%%@@@%%%%%%#++++===+*%%%%%
@@@@@@@@%@@@@@@@@%%%%#**++===++*%%%%##%
+##%@@@@@@@@@@@@@%%##**+++++=+#%%%%%%%%#%
++*##%%%@@@@%@%%%###***+==+==+%%%%%%%%%%#####
+++**#%###########****++==+==*%%%%%%%%%%%%%%########
+++++*#%%####*********+===+++#%%%%%%%%%%%%%%%%%%%#######%%
%#++++++*#%#**********+====+=+%%%%%%%%%%%%%%%%%%%%%%#%##########
%%%%%%*+++=+++*###++++++++=======*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%##%####
%%%%%%%%%%+++++++++###*+++++++======#%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%#++++++++###*+++++++====+#%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%+++*#++=*#**++++++++==+#%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Display Oscar Gil Image:
from art import print_art
print_art("oscar_gil_wb")
Oscar Gil
%@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@
%%@@@@@@@@@@@@@@@@@@@@@@@@@@
%@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@%%#%%%%%@@@@@@@@@@@@@@@
%@@@@@@@%%#*****************###%%@@@@@@@
@@@@@@%#**************************#@@@@@@
@@@@@%#****************************#%@@@@
@@@@%#*************+****************%@@@@
%@@@#*************+++++*************#%@@@
@@@%**************+++*+*************#%@@@%
@@%#******************+**************%@@@%
%@%#************++*+*+*++++**********#@@@%
@@%#**************+**+***************#%@@%
@@#**#%%%%%@@%%#*******#%%%%%%%##***#@@%
%@%**#%%%%%%%%%%%*****#%%%%%#####***#@%**
*%#***#%%%%##***#********#%%%%#******%***
#*#**************************************
*#*************************************
*##******++*******+*******+++*********
**#***************+********++*********
**#***********%%*****#%***************
*********##%%%%%%@%%##*************
*******#%%##**********#%#*********
#********#%%#********%%##********
##****************************##
%####**********************###
%%%%#*******##*********######
%%%%%%#******+*******#%####***
##%%%%##***********%%###******##
%##%%%%%%##***##%%%%%#*********#*##*
%%%%%%#*#%%%%@@@@%%%%%%%#************##%#%#####
%%%%%%#******#%%%%%%%%%%%#************##%####%%%##%##
##%%%%%%%%#**********#%%###**************####%%###%#%%#%%##%%##
%####%%%%%%%%%%%***************************###%%%%%#%%%#%%%%###%%%%##%###
##%#####%%%%%%%%%%%%%#************************##%%%%#%%#######%##%%%%###%#####
########%##%%%#%%%%%%%%%%%#*****************#%##%%%%#%%%####%###%################
####%%####%%#%%###%%%%%%%%%%%%%%#######%%%%%%%%%%%%%%%##%%%%%%%#####%%############
Display UCLA Royce Hall Image:
from art import print_art
print_art("royce_hall_wb")
%############+ %############%
@###%*#%#####* %%####%####%##%
%##%@*%%*@####* %@###@%###@%##%
%##%@+@@*@####* @@###@####@%###
###%@+@%*@####* @@###@####@###%
###********#### UCLA Royce Hall @@##********###
############### @@#############
############### %@#############
############### ##*##%##*## %@#############
###############*############%######*%@#############
####################%+######%*#####################
####################%+#@@%@@########%############## @@@@@@%
@@@@@@@@@@@@@@@@@##############%@@@%#+%#%###%*##@@@%##############@@@@@@@@@@@@@@@@@
%%%%%%%%%%%%%%%%%###%########*%%%@@%%+#%@@%%%+%%@@%@%####@#########################
%%%%%%%%%%%%%%%%%############*%%@@@@#+%%@@@%#+%@@@@%%##############################
@@%%%%%@@%%%%%@@@##**########*%@@@@@#+%@@@@@%+%@@@@@%#############%@%#####@@#####@@
@@%%%%%@@%%%%%@@@###%########++++++++++++++++*++++++++###@########%@%#####@@#####@@
@@%%%%%@@%%%%%@@%####*#######+++++++*+++++++#+++++++*+####%###%%##%@%#####@@#####@@
%@%%@@@@@@%%%%@%@############++%@@%#*++#%%%#*++#%@@%*+############%#%#####%%%%%##%#
++++#*+**+*%%%%%%############+%%@@@@#+#@@@@@#+%@@@@@%+############*++***+*+++**++*+
+**+#*+**+*%%%%%%############+%@#####+%%###%#+#####@%*############+*+*++**+*+**+*#+
+%@%@%%@##@@@@%@%####%%@@####+%%%%%%#+%%%%%%#+#%%%%@%+####@%%%####%@#@%@@#*@%@@%@%+
+@@%@@%@*#@@@@%@@###%@%@@####+%%%@@%#+%%@@@%#+#@@@%@%+####@@@@%#%#@@#@%@@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@@@@@@@@@@@@@@@@@@@@@@@@@+..
=@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+..
.@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@=..
.:@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@-.
..%@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@-.
...#@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@.
...%@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@:.
..+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@%:
....#@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@%..
.%@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@...
.*@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@:
..#%#%@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@..
........:@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@#.
.:...-....-#@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@#...
.... ... . ..:@@@@@@@@@@@@@@@@@@@@@@@@@@@@%.
.:.-@@@@@@@@@@@@@@@@@@@@@@@@@%.
. =:. ..%@@@@@@@@@@@@@@@@@@@@@@.
.=. .. ..@@@@@@@@@@@@@@@@@@@@*.
. . :. ..%@@@@@@@@@@@@@@@@@@%=.
.+. .#@@@@@@@@@@@@@@@@@@@@.
. .*@@@@@@%*+=-:::.......
.. . ..
Display All Artwork:
from art import print_art
print_art(all=True)
Save Artwork to a File:
from art import print_art
print_art("royce_hall_bb", output_file="royce_hall.txt", output_path="./artworks")
Handle Missing Artwork:
from art import print_art
print_art("unknown_art")
'unknown_art' not found. Available options are: eda_toolkit_logo, leon_shpaner_bb, ...
Key Details
Default Behavior: If no artwork name is provided and
all
isFalse
, a list of available options is displayed.Output Handling: If
output_file
andoutput_path
are specified, the function creates the directory (if needed) and saves the ASCII art to the file.
Notes
Ensure that the ascii_art
dictionary contains the desired artwork and keys are correctly referenced when using the print_art
function.