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 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 to False.

  • 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 and all=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 Grey Alien Image:

from art import print_art

print_art("grey_alien_wb")
                           +-:::::::::::::::-=+
                     +::........:::::::::::-:::::::=#
                 *:...........::::::::::::-----:-:--:::=
               -...........:.::::::::::::::-:-----------::=
             -:.....::::::......::::::---------------------:=
            :...::...:::::::.::::::::::------------::--------:=
          =...:.::.....:::::::::::::::::-----------::::--:-----:=
         =:....:.:.::.::::::::.::::::::-----==---:::::::--:-----:-
        -:::.:::::::::.......::::::::::----====--:::::::--------=--#
       =:::::::::::::..::......::::::::----====--::::::--------=====*
      +::....::::::.:....::::::::::::::----====--:::::---------======#
      ::.....::::::::::...:......:::::::----===----::-----=========++*
     -:.::::.:::::::.::::.......::::::::----====--------=-========++*+#
    +:::....::::::::.::::::.:::.:::::::::----===-=-----==========++****#
   +::::..::.:::::::::-:::...::::::.::::::-----==-============+++++*##*#
   =::.::::::::::::::::::.:::.:...::::::::::-----===+++==+++++++++**####%
  +:::.:::::::::::::::...............::::::::----===+++++++++++****######
  -::....:::::::::::::...........:::::::::::::---===++++++++**+***###%%%#@
 *:........:::::::::::......::::::---------------===++*+*++*****####%%%%%%
 -:........::::---::::.::::---=++**########*++++++==++******#*#***##%%%%%%
=::::::::..::::--:::::::--=+*%@@@@@@%#***##%@@%#*++*+*###*##########%%@@%%@
=--====--::::::---::::-=+*%@@@@%*+*#%%@@@%%#*++#%*++**#%%###%%#####%%@@@@%@
*#%%@@%#+=--:::---::-=+*%@@@@##@@%%%%%%%@@@@@@@#*#+++*%%@%%%%%%###%%%@@@@%@
%@***#%@@@#*+-------=*#%@@@%*@@@@@%%%%@%@@@@@@@+#==+*#@@@@@@@%%%%%%%@@@@@%@
@%@@@@@%**%@%*=-----+#%%@@##@@@@@@@@@@@@@@@@@@*##=-+*%@@@@@@@@%%%%%@@@@@@@
%@@@@@@%%%%*%%#=---=+#%%@%*@@@@@@@@@@@@@@@@@@#%@=-=+#%@@@@@@@@@%@@@@@@@@@@
%@@@@@@@@@@@%*%*=--=+*####*@@@@@@@@@@@@@@@@%*%%=-=+#%@@@@@@@@@@@@@@@@@@@@
#@@@@@@@@@@@@@**+---=++**#*@@@@@@@@@@@@@@%*@@%+-=+#%@@@@@@@@@@@@@@@@@@@@@
*%@@@@@@@@@@@@@*=:::--=+=#*%#@@@@@@@@%**#@@%*===+*%@@@@@@@@@@@@@@@@@@@@@
 +@@@@@@@@@@@@@+-:..:::-=+*+++++**##%@@@%%+=-==*#%@@@@@@@@@@@@@@@@@@@@@
 @*#@@@@@%#*++*+:..::::::----=+*##%##*+-----=+*%@@@@@@@@@@@@@@@@@@@@@@
  *@@@%%%##*=--:-:--:::::::::::::::::::---=+*#@@@@@@@@@@@@@@@@@@@@@@@
  %==+*+=--::::-#:+@*--:::::::::::::---=+*#%@@@@@@@@@@@@@@@@@@@@@@@
   #+-::::::::--=:==-:---:::::::-----=+*#@@@@@@@@@@@@@@@@@@@@@@@@
     #=--::-:--:::::::::---::--==++*#%@@@@@@@@@@@@@@@@@@@@@@@@@@
      @#*===----::::::-::--=--==+*%@@@@@@@@@@@@@@@@@@@@@@@@@@@@
          %+=--:::::::::----=====+*##%@@@@@@@@@@@@@@@@@@@@@@@@
          @#=--:--::---------===+****#%%@@@@@@@@@@@@@@@@@@@@@
           %+=====+++++=+====++=+*****##%%@@@@@@@@@@@@@@@@@
            %+#@@%%%%%%%@%+=+++++++++*##%@@@@@@@@@@@@@@@@
             *=+=+++====--=+**++++++*#%@@@@@@@@@@@@@@@@
             %*====----==++**+++**#%@@@@@@@@@@@@@@@@@
              %=::::::::-==+++**#%@@@@@@@@@@@@@@@@@@@
               #=-:::---=+*###%@@@@@@@@@@@@@@@@@@@@@@
                %*++++*#%@@@@@@@@@@@@@@@@@@@@@@@@@@@@
                  @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
                     @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
                           @@@@@@@@@@@@@@@@@@@@@@@@@@
                             @@@@@@@@@@@@@@@@@@@@@@@@@
                             @@@@@@@@@@@@@@@@@@@@@@@@@
                              @@@@@@@@@@@@@@%@@@@%%%%@%
                              @@@@@@@@@@@@%%%@@%%%%%##%%
                              @@@@@@@@@@%%##%%%###%######%
                              @@@@@@@@@%#***%@***####*******
                              %#%@@@@%%#*++*%#++***##*++++++++*
                             ***#######*+++*#**+++*##*+==========
                          *==+*+*******===+**+*++++***+==-=--------=+
                       +=--==+==***++++=-=+++***+==**++===------------=
                    *=---===++==++++++===+++++#*+============------===---*
                 *============-=+++++=--=++==+**==-----==========--===-====#
               +---====---==+=-=+=====-=+==--==+==--------==-==---------:-=+*#
             =---::------=-==--======-=++==----==------------:::::-:------::-=-*
           +---:----::----==--=+====--====---------::::::--:---:::::-------=--:-=
          ----::-=+=----------=====-:------------:::----====---:::-:--------=+====*
         ---:::-=====----::::-==-=-::-:::----------====+++==---::::::---::---=====+
        =--:::--=-===---::::::----::::::-------===============--::::::::----=====++
       =---:::-=-----==--::--------::::----==-------------=====--::::--------====++
      +----:-------------::----=--::::---------------------====----:::-------====++

Display UCLA Royce Hall Image:

from art import print_art

print_art("royce_hall_wb")
                %############+                       %############%
                @###%*#%#####*                      %%####%####%##%
                %##%@*%%*@####*                     %@###@%###@%##%
                %##%@+@@*@####*                     @@###@####@%###
                ###%@+@%*@####*                     @@###@####@###%
                ###********####   UCLA Royce Hall   @@##********###
                ###############                     @@#############
                ###############                     %@#############
                ###############     ##*##%##*##     %@#############
                ###############*############%######*%@#############
                ####################%+######%*#####################
                ####################%+#@@%@@########%##############    @@@@@@%
@@@@@@@@@@@@@@@@@##############%@@@%#+%#%###%*##@@@%##############@@@@@@@@@@@@@@@@@
%%%%%%%%%%%%%%%%%###%########*%%%@@%%+#%@@%%%+%%@@%@%####@#########################
%%%%%%%%%%%%%%%%%############*%%@@@@#+%%@@@%#+%@@@@%%##############################
@@%%%%%@@%%%%%@@@##**########*%@@@@@#+%@@@@@%+%@@@@@%#############%@%#####@@#####@@
@@%%%%%@@%%%%%@@@###%########++++++++++++++++*++++++++###@########%@%#####@@#####@@
@@%%%%%@@%%%%%@@%####*#######+++++++*+++++++#+++++++*+####%###%%##%@%#####@@#####@@
%@%%@@@@@@%%%%@%@############++%@@%#*++#%%%#*++#%@@%*+############%#%#####%%%%%##%#
++++#*+**+*%%%%%%############+%%@@@@#+#@@@@@#+%@@@@@%+############*++***+*+++**++*+
+**+#*+**+*%%%%%%############+%@#####+%%###%#+#####@%*############+*+*++**+*+**+*#+
+%@%@%%@##@@@@%@%####%%@@####+%%%%%%#+%%%%%%#+#%%%%@%+####@%%%####%@#@%@@#*@%@@%@%+
+@@%@@%@*#@@@@%@@###%@%@@####+%%%@@%#+%%@@@%#+#@@@%@%+####@@@@%#%#@@#@%@@#*@%@@%@@+
                    @@@@@@@##*%%%%%%#*%%%@%%#*#%@%%%%+##@

Display California State Image:

from art import print_art

print_art("ca_state_wb")
   ..                           ...
 ..@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@.
 .:@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@.
   -@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@.
   :@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@.
  .#@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@.
   #@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@.
..:%@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@.
..@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@.
.*@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@.
..@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@.
...:@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@.
  ...%@@@@@@@@@@@@@@@@@@@@@@@@@@@@.
     :@@@@@@@@@@@@@@@@@@@@@@@@@@@@.
     -@@@@@@@@@@@@@@@@@@@@@@@@@@@@.
    .:@@@@@@@@@@@@@@@@@@@@@@@@@@@@.
    ..+@@@@@@@@@@@@@@@@@@@@@@@@@@@...
    . =@@@@@@@@@@@@@@@@@@@@@@@@@@@@-.
       .+@@@@@@@@@@@@@@@@@@@@@@@@@@@@-.
        ..#@@@@@@@@@@@@@@@@@@@@@@@@@@@@=.
          .=@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+.
           .%@@#-@##%%@@@@@@@@@@@@@@@@@@@@@+..
           ..-%#+@@@@@@@@@@@@@@@@@@@@@@@@@@@@*...
              .*+*@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*..
              .+@%+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@#. .
               .@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*..
               .-@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*..
                 ...%@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+..
                   .=@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+..
                   =@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+..
                   .@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@=..
                    .:@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@-.
                     ..%@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@-.
                     ...#@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@.
                       ...%@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@:.
                         ..+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@%:
                         ....#@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@%..
                            .%@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@...
                            .*@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@:
                            ..#%#%@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@..
                              ........:@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@#.
                              .:...-....-#@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@#...
                              .... ...   . ..:@@@@@@@@@@@@@@@@@@@@@@@@@@@@%.
                                             .:.-@@@@@@@@@@@@@@@@@@@@@@@@@%.
                                          . =:.  ..%@@@@@@@@@@@@@@@@@@@@@@.
                                    .=.      ..    ..@@@@@@@@@@@@@@@@@@@@*.
                                      .   . :.      ..%@@@@@@@@@@@@@@@@@@%=.
                                            .+.      .#@@@@@@@@@@@@@@@@@@@@.
                                             .        .*@@@@@@%*+=-:::.......
                                                      .. .  ..

Display All Artworks on Black Background:

from art import print_art

print_art(suffix="bb")

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 is False, a list of available options is displayed.

  • Output Handling: If output_file and output_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.