___           ___                 
     /  /\         /  /\          ___   
    /  /::\       /  /::\        /  /\  
   /  /:/\:\     /  /:/\:\      /  /:/  
  /  /:/~/::\   /  /:/~/:/     /  /:/   
 /__/:/ /:/\:\ /__/:/ /:/___  /  /::\   
 \  \:\/:/__\/ \  \:\/:::::/ /__/:/\:\  
  \  \::/       \  \::/~~~~  \__\/  \:\ 
   \  \:\        \  \:\           \  \:\
    \  \:\        \  \:\           \__\/
     \__\/         \__\/                

___  _   _    ____ ____ ___  ____ _  _ ___     _  _ ____ ____ _  _ _ ____ _  _ _ 
|__]  \_/     [__  |___ |__] |__| |\ | |  \    |__| |__| | __ |__| | | __ |__| | 
|__]   |      ___] |___ |    |  | | \| |__/    |  | |  | |__] |  | | |__] |  | | 
                                                                                 

 _  _  ____  ____  ___  ____  _____  _  _    ___     ___  
( \/ )( ___)(  _ \/ __)(_  _)(  _  )( \( )  (__ )   / _ \ 
 \  /  )__)  )   /\__ \ _)(_  )(_)(  )  (    (_ \  ( (_) )
  \/  (____)(_)\_)(___/(____)(_____)(_)\_)  (___/() \___/ 



        
PyPI version built with Python3

Overview

ASCII art is also known as "computer text art". It involves the smart placement of typed special characters or letters to make a visual shape that is spread over multiple lines of text. ART is a Python lib for text converting to ASCII art fancy. ;-)

Open Hub
PyPI Counter
Font Counter 360
1-Line-Art Counter 250

Install


Source code

PyPI

Conda

Easy install

  • Run easy_install "art==3.0" Need root access

Note

  • On --upgrade error install latest version of setuptools : pip install setuptools and retry

Usage


Quick Start

1-Line art

  1. art
  2. This function return 1-line art as `str` in normal mode and raise `artError` in exception

     1
     2
     3
     4
     5
     6
     7
     8
     9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    >>> from art import *
    >>> art_1=art("coffee") # return art as str in normal mode
    >>> print(art_1)
    c[_]
    >>> art_2=art("woman",number=2) # return multiple art as str
    >>> print(art_2)
    ▓⚗_⚗▓ ▓⚗_⚗▓ 
    >>> art_3=art("love_you",number=1,text="test") # 2-part art
    >>> print(art_3)
    »-(¯`·.·´¯)->test<-(¯`·.·´¯)-« 
    >>> art("random") # random 1-line art mode
    '(っ◕‿◕)っ '
    >>> art("rand")   # random 1-line art mode
    't(-_-t) '
    >>> art(22,number=1,text="") # raise artError
    Traceback (most recent call last):
    ...
    art.art.artError: artname shoud have str type
    
     
  3. aprint
  4. This function print 1-line art in normal mode (return None) and raise `artError` in exception

     1
     2
     3
     4
     5
     6
     7
     8
     9
    10
    11
    12
    13
    14
    >>> aprint("butterfly") # print art
    Ƹ̵̡Ӝ̵̨̄Ʒ 
    >>> aprint("happy") # print art
     ۜ\(סּںסּَ` )/ۜ
    >>> aprint("love_you",number=1,text="test")  # 2-part art
    »-(¯`·.·´¯)->test<-(¯`·.·´¯)-« 
    >>> aprint("random") # random 1-line art mode
    '(っ◕‿◕)っ '
    >>> aprint("rand")   # random 1-line art mode
    't(-_-t) '
    >>> aprint("woman",number="22",text="") # raise artError
    Traceback (most recent call last):
            ...
    art.art.artError: number should have int type
    

ASCII text

⚠️ Some fonts don't support all characters

  1. text2art
  2. This function return ascii text as `str` in normal mode and raise `artError` in exception

     1
     2
     3
     4
     5
     6
     7
     8
     9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    >>> 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)
    ___ ____ ____ ___ 
     |  |___ [__   |  
     |  |___ ___]  | 
     
    >>> text2art("seسسس",font=DEFAULT_FONT,chr_ignore=False) # raise artError in exception
    Traceback (most recent call last):
            ...
    art.art.artError: س is invalid    
    
     
  3. tprint
  4. This function print ascii text in normal mode (return None) and raise `artError` in exception

     1
     2
     3
     4
     5
     6
     7
     8
     9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    >>> tprint("art") # print ascii text (default font) 
                  _   
      __ _  _ __ | |_ 
     / _` || '__|| __|
    | (_| || |   | |_ 
     \__,_||_|    \__|
                      
    
    >>> tprint("art",font="block",chr_ignore=True) # print ascii text (block font)
    
     .----------------.  .----------------.  .----------------.
    | .--------------. || .--------------. || .--------------. |
    | |      __      | || |  _______     | || |  _________   | |
    | |     /  \     | || | |_   __ \    | || | |  _   _  |  | |
    | |    / /\ \    | || |   | |__) |   | || | |_/ | | \_|  | |
    | |   / ____ \   | || |   |  __ /    | || |     | |      | |
    | | _/ /    \ \_ | || |  _| |  \ \_  | || |    _| |_     | |
    | ||____|  |____|| || | |____| |___| | || |   |_____|    | |
    | |              | || |              | || |              | |
    | '--------------' || '--------------' || '--------------' |
     '----------------'  '----------------'  '----------------'
    
    >>> tprint('testسس')  # chr_ignore flag ==True (Default)
     _               _   
    | |_   ___  ___ | |_ 
    | __| / _ \/ __|| __|
    | |_ |  __/\__ \| |_ 
     \__| \___||___/ \__|
                         
    >>> tprint("test","random") # random font mode
     |       | 
    ~|~/~/(~~|~
     | \/__) | 
               
    >>> tprint("test","rand") # random font mode
    ___ ____ ____ ___ 
     |  |___ [__   |  
     |  |___ ___]  | 
     
     
    >>> tprint('testسس',chr_ignore=False) # raise artError in exception 
    Traceback (most recent call last):
           ...
    art.art.artError: س is invalid
    >>> tprint('''Lorem  # Multi-line print
    ipsum 
    dolor''', font="cybermedium")
    _    ____ ____ ____ _  _    
    |    |  | |__/ |___ |\/|    
    |___ |__| |  \ |___ |  |    
                                
    _ ___  ____ _  _ _  _    
    | |__] [__  |  | |\/|    
    | |    ___] |__| |  |    
                             
    ___  ____ _    ____ ____ 
    |  \ |  | |    |  | |__/ 
    |__/ |__| |___ |__| |  \ 
    
     
  5. tsave
  6. This function return `dict` in normal and exception mode

     1
     2
     3
     4
     5
     6
     7
     8
     9
    10
    11
    12
    >>> Response=tsave("art",filename="test.txt") # save ascii text in test.txt file with save message (print_status==True) # return dict
    Saved! 
    Filename: test.txt
    >>> Response["Message"]
    'OK'
    >>> Response=tsave("art",filename="test.txt",print_status=False) # save ascii text in test.txt file without save message (print_status==False)
    >>> Response["Message"]
    'OK'
    >>> Response["Status"]
    True
    >>> tsave(22,font=DEFAULT_FONT,filename="art",chr_ignore=True,print_status=True)
    {'Status': False, 'Message': "'int' object has no attribute 'split'"}
    

Font modes

These modes are available for text2art, tprint & tsave.

  1. Font name
  2. ⚠️ Some fonts don't support all characters

     
     1
     2
     3
     4
     5
     6
     7
     8
     9
    10
    11
    12
    13
    >>> tprint("art",font="block",chr_ignore=True)
    
     .----------------.  .----------------.  .----------------.
    | .--------------. || .--------------. || .--------------. |
    | |      __      | || |  _______     | || |  _________   | |
    | |     /  \     | || | |_   __ \    | || | |  _   _  |  | |
    | |    / /\ \    | || |   | |__) |   | || | |_/ | | \_|  | |
    | |   / ____ \   | || |   |  __ /    | || |     | |      | |
    | | _/ /    \ \_ | || |  _| |  \ \_  | || |    _| |_     | |
    | ||____|  |____|| || | |____| |___| | || |   |_____|    | |
    | |              | || |              | || |              | |
    | '--------------' || '--------------' || '--------------' |
     '----------------'  '----------------'  '----------------'
    
     
  3. Random
  4. Randomly select from all fonts.

    Keywords : random, rand & rnd

    1
    2
    3
    4
    5
    >>> tprint("test",font="random")
     |       | 
    ~|~/~/(~~|~
     | \/__) | 
     
    
     
  5. Random small
  6. Randomly select from small fonts.

    Keywords : rnd-small, random-small & rand-small

    Note : New in Version 2.8

    1
    2
    3
    4
    5
    >>> tprint("test",font="rnd-small")
                 
    _/  _   _ _/ 
    /  (- _)  /  
                
    
     
  7. Random medium
  8. Randomly select from medium fonts.

    Keywords : rnd-medium, random-medium & rand-medium

    Note : New in Version 2.8

     1
     2
     3
     4
     5
     6
     7
     8
     9
    10
    >>> tprint("test",font="rnd-medium")
                          
      ,                ,  
     ||               ||  
    =||=  _-_   _-_, =||= 
     ||  || \\ ||_.   ||  
     ||  ||/    ~ ||  ||  
     \\, \\,/  ,-_-   \\, 
                          
     
    
     
  9. Random large
  10. Randomly select from large fonts.

    Keywords : rnd-large, random-large & rand-large

    Note : New in Version 2.8

     1
     2
     3
     4
     5
     6
     7
     8
     9
    10
    11
    12
    >>> tprint("test",font="rnd-large")
                                                                        
    8888888 8888888888 8 8888888888      d888888o.   8888888 8888888888 
          8 8888       8 8888          .`8888:' `88.       8 8888       
          8 8888       8 8888          8.`8888.   Y8       8 8888       
          8 8888       8 8888          `8.`8888.           8 8888       
          8 8888       8 888888888888   `8.`8888.          8 8888       
          8 8888       8 8888            `8.`8888.         8 8888       
          8 8888       8 8888             `8.`8888.        8 8888       
          8 8888       8 8888         8b   `8.`8888.       8 8888       
          8 8888       8 8888         `8b.  ;8.`8888       8 8888       
          8 8888       8 888888888888  `Y8888P ,88P'       8 8888       
    
     
  11. Random xlarge
  12. Randomly select from xlarge fonts.

    Keywords : rnd-xlarge, random-xlarge & rand-xlarge

    Note : New in Version 2.8

     1
     2
     3
     4
     5
     6
     7
     8
     9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    >>> tprint("test","rnd-xlarge")
          _____                    _____                    _____                _____          
         /\    \                  /\    \                  /\    \              /\    \         
        /::\    \                /::\    \                /::\    \            /::\    \        
        \:::\    \              /::::\    \              /::::\    \           \:::\    \       
         \:::\    \            /::::::\    \            /::::::\    \           \:::\    \      
          \:::\    \          /:::/\:::\    \          /:::/\:::\    \           \:::\    \     
           \:::\    \        /:::/__\:::\    \        /:::/__\:::\    \           \:::\    \    
           /::::\    \      /::::\   \:::\    \       \:::\   \:::\    \          /::::\    \   
          /::::::\    \    /::::::\   \:::\    \    ___\:::\   \:::\    \        /::::::\    \  
         /:::/\:::\    \  /:::/\:::\   \:::\    \  /\   \:::\   \:::\    \      /:::/\:::\    \ 
        /:::/  \:::\____\/:::/__\:::\   \:::\____\/::\   \:::\   \:::\____\    /:::/  \:::\____\
       /:::/    \::/    /\:::\   \:::\   \::/    /\:::\   \:::\   \::/    /   /:::/    \::/    /
      /:::/    / \/____/  \:::\   \:::\   \/____/  \:::\   \:::\   \/____/   /:::/    / \/____/ 
     /:::/    /            \:::\   \:::\    \       \:::\   \:::\    \      /:::/    /          
    /:::/    /              \:::\   \:::\____\       \:::\   \:::\____\    /:::/    /           
    \::/    /                \:::\   \::/    /        \:::\  /:::/    /    \::/    /            
     \/____/                  \:::\   \/____/          \:::\/:::/    /      \/____/             
                               \:::\    \               \::::::/    /                           
                                \:::\____\               \::::/    /                            
                                 \::/    /                \::/    /                             
                                  \/____/                  \/____/                              
    
     
  13. Wizard
  14. This mode consider length of input text to select font.

    Keywords : wizard, wiz & magic

    Note : New in Version 2.9

     1
     2
     3
     4
     5
     6
     7
     8
     9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    >>> tprint("1","wizard")
        88 
      ,d88 
    888888 
        88 
        88 
        88 
        88 
        88 
        88 
        88 
           
                
    
    >>> tprint("1"*5,"wizard")
    d88  d88  d88  d88  d88  
     88   88   88   88   88  
     88   88   88   88   88  
     88   88   88   88   88  
     88   88   88   88   88  
    d88P d88P d88P d88P d88P 
                             
                             
    
    >>> tprint("1"*15,"wizard")
                                                 
                                                 
     #  #  #  #  #  #  #  #  #  #  #  #  #  #  # 
    ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## 
     #  #  #  #  #  #  #  #  #  #  #  #  #  #  # 
     #  #  #  #  #  #  #  #  #  #  #  #  #  #  # 
     #  #  #  #  #  #  #  #  #  #  #  #  #  #  # 
    ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## 
    

Typo-tolerance

Levenshtein distance used in this project. (>Version 0.9)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
>>> Art=art("loveyou",number=1,text="test") # correct --> art("love_you",number=1,text="test") (distance < 3)
>>> print(Art)
»-(¯`·.·´¯)->test<-(¯`·.·´¯)-« 
>>> aprint("happi")  # correct --> aprint("happy") (distance < 3)
 ۜ\(סּںסּَ` )/ۜ 
>>> Art=art("birds2222",number=1) # correct --> Art=art("birds",number=1) (distance > 3)
>>> print(Art)
Traceback (most recent call last):
	...
art.art.artError: Invalid art name
>>> aprint("happi231")  # correct --> aprint("happy") (distance > 3)
Traceback (most recent call last):
	...
art.art.artError: Invalid art name
>>> Art=text2art("test",font="black") # correct --> Art=text2art("test",font="block")
>>> print(Art)

 .----------------.  .----------------.  .----------------.  .----------------.
| .--------------. || .--------------. || .--------------. || .--------------. |
| |  _________   | || |  _________   | || |    _______   | || |  _________   | |
| | |  _   _  |  | || | |_   ___  |  | || |   /  ___  |  | || | |  _   _  |  | |
| | |_/ | | \_|  | || |   | |_  \_|  | || |  |  (__ \_|  | || | |_/ | | \_|  | |
| |     | |      | || |   |  _|  _   | || |   '.___`-.   | || |     | |      | |
| |    _| |_     | || |  _| |___/ |  | || |  |`\____) |  | || |    _| |_     | |
| |   |_____|    | || | |_________|  | || |  |_______.'  | || |   |_____|    | |
| |              | || |              | || |              | || |              | |
| '--------------' || '--------------' || '--------------' || '--------------' |
 '----------------'  '----------------'  '----------------'  '----------------'

>>> tprint("test",font="cybermedum")   # correct --> tprint("test",font="cybermedium")
___ ____ ____ ___ 
 |  |___ [__   |  
 |  |___ ___]  |  
                     

Set defaults

set_default function is added in Version 2.2 in order to change default values.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
>>> help(set_default)
Help on function set_default in module art.art:

set_default(font='standard', chr_ignore=True, filename='art', print_status=True)
    This fuction change text2art tprint and tsave default values
    :param font: input font
    :type font:str
    :param chr_ignore: ignore not supported character
    :type chr_ignore:bool
    :param filename: output file name (only tsave)
    :type filename:str
    :param print_status : Save message print flag (only tsave)
    :type print_status:bool
    :return: None

>>> tprint("test")
 _               _   
| |_   ___  ___ | |_ 
| __| / _ \/ __|| __|
| |_ |  __/\__ \| |_ 
 \__| \___||___/ \__|
                     

>>> set_default(font="italic")
>>> tprint("test")
             
_/  _   _ _/ 
/  (- _)  /  
             

* Functions error response updated in Version 0.8

Function Normal Error
art str raise artError
aprint None raise artError
tprint None raise artError
tsave {"Status":bool,"Message":str} {"Status":bool,"Message":str}
text2art str raise artError

CLI

  • List of arts : python -m art list or python -m art arts
  • List of fonts : python -m art fonts
  • Test : python -m art test
  • Text : python -m art text yourtext fontname(optional)
  • Art : python -m art shape art_name or python -m art art art_name
  • Save : python -m art save yourtext fontname(optional)
  • All : python -m art all yourtext

Try ART in your browser

ART can be used online in interactive Jupyter Notebooks via the Binder service! Try it out now! :


 
  • Open FontList.ipynb and ArtList.ipynb
  • Screen record

    Screen record