Skip to main content

ASCII Art Library For Python

Project description

      ___           ___                   
     /\  \         /\  \                  
    /::\  \       /::\  \         ___     
   /:/\:\  \     /:/\:\__\       /\__\    
  /:/ /::\  \   /:/ /:/  /      /:/  /    
 /:/_/:/\:\__\ /:/_/:/__/___   /:/__/     
 \:\/:/  \/__/ \:\/:::::/  /  /::\  \     
  \::/__/       \::/~~/~~~~  /:/\:\  \    
   \:\  \        \:\~~\      \/__\:\  \   
    \:\__\        \:\__\          \:\__\  
     \/__/         \/__/           \/__/  
Codecov PyPI version built with Python3

Table of contents

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
Github Stars
Font Counter 175
1-Line-Art Counter 250

Usage

1-Line Art

  1. art

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

>>> 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

  1. aprint

This function print 1-line art in normal mode (return None) and raise artError in exception

>>> 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

  1. text2art

This function return ascii text as str in normal mode and raise artError in exception

	
>>> 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 
             
  1. tprint

This function print ascii text in normal mode (return None) and raise artError in exception

>>> 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")
_    ____ ____ ____ _  _    
|    |  | |__/ |___ |\/|    
|___ |__| |  \ |___ |  |    
                            
_ ___  ____ _  _ _  _    
| |__] [__  |  | |\/|    
| |    ___] |__| |  |    
                         
___  ____ _    ____ ____ 
|  \ |  | |    |  | |__/ 
|__/ |__| |___ |__| |  \ 


  1. tsave

This function return dict in normal and exception mode

>>> 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'"}
                        
  • Note : Functions error response updated in Version 0.8
Function Normal Output 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

Typo-Tolerance

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

>>> 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")
___ ____ ____ ___ 
 |  |___ [__   |  
 |  |___ ___]  |  
                  
   

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

Telegram Bot

Just send your text to one of these bots. 👇👇👇👇

Screen Record

Screen Record

Issues & Bug Reports

Just fill an issue and describe it. I'll check it ASAP! or send an email to sepand@qpage.ir.

License

FOSSA Status

Reference

  1. 1 Line Art
  2. Text To ASCII

Donate to our project

Bitcoin :

12Xm1qL4MXYWiY9sRMoa3VpfTfw6su3vNq

Payping (For Iranian citizens)

Say Thanks!

Changelog

All notable changes to this project will be documented in this file.

The format is based on Keep a Changelog and this project adheres to Semantic Versioning.

Unreleased

2.1 - 2018-09-18

Added

  • 15 new fonts
    1. fraktur
    2. funface
    3. funfaces
    4. georgi16
    5. georgia11
    6. ghost
    7. ghoulish
    8. glenyn
    9. graceful
    10. greek
    11. heartleft
    12. heartright
    13. henry3d
    14. horizontalleft
    15. horizontalright

Changed

  • setuptools removed from requirements.txt
  • OSX env added to .travis.yml
  • Test cases modified
  • text2art bug in OSX fixed

2.0 - 2018-08-30

Added

  • 20 new fonts
    1. bigfig
    2. bolger
    3. braced
    4. bright
    5. broadway
    6. cards
    7. chiseled
    8. cola
    9. crawford
    10. cricket
    11. DANC4
    12. dancingfont
    13. decimal
    14. defleppard
    15. dietcola
    16. flipped
    17. double
    18. doubleshorts
    19. eftipiti
    20. filter
  • Font list HTML page
  • Art list HTML page

1.9 - 2018-08-23

Added

  • 20 new fonts
    1. cybersmall
    2. gothic
    3. rev
    4. smtengwar
    5. term
    6. 1row
    7. 3d_diagonal
    8. 4max
    9. amc3line
    10. amcrazor
    11. amcaaa01
    12. amcneko
    13. amcrrazo2
    14. amcslash
    15. amcthin
    16. amctubes
    17. amcun1
    18. arrows
    19. bear
    20. benjamin

1.8 - 2018-08-06

Added

  • 30 new 1-line art
    1. westbound fish
    2. telephone
    3. 9/11 truth
    4. spear
    5. srs face
    6. this is areku
    7. robot boy
    8. med man
    9. angry
    10. badass
    11. zoidberg
    12. eastbound fish
    13. kilroy was here
    14. gtalk fit
    15. thanks
    16. dalek
    17. sean the sheep
    18. kablewee
    19. i dont care
    20. slenderman
    21. john lennon
    22. peace yo
    23. punch
    24. russian boobs
    25. fuck off
    26. man tears
    27. robber
    28. facepalm
    29. yo
    30. party time

1.7 - 2018-08-01

Added

  • 30 new 1-line art
    1. crayons
    2. stars in my eyes
    3. fish invasion
    4. bender
    5. musical
    6. sunny day
    7. happy birthday 1
    8. line brack
    9. med
    10. melp1
    11. happy3
    12. happy square
    13. snowman
    14. melp2
    15. i kill you
    16. jaymz
    17. text decoration
    18. long rose
    19. kirbay dance
    20. death star defense team
    21. chainsword
    22. boobies
    23. dancing people
    24. dance
    25. pictou
    26. polar bear
    27. go away bear
    28. charly
    29. train
    30. spot

Changed

  • car race 1-line art fixed

1.6 - 2018-07-10

Added

  • 30 new 1-line art
    1. sexy symbol
    2. barbell
    3. sniper rifle
    4. being draged
    5. possessed
    6. jokeranonimous
    7. epic gun
    8. love
    9. love2
    10. eric
    11. puls
    12. sky free
    13. smug bastard
    14. tie-fighter
    15. kyubey
    16. dancee
    17. mtmtika
    18. ak-47
    19. eaten apple
    20. huhu
    21. faydre
    22. domino
    23. honeycute
    24. superman
    25. worm2
    26. jokeranonimous2
    27. kyubey2
    28. nose2
    29. hell yeah
    30. roke

1.5 - 2018-06-18

Added

  • 30 new 1-line art
    1. sorreh bro
    2. yolo
    3. formula 1 car
    4. dummy
    5. rope
    6. rare
    7. chess pieces
    8. sparkling heart
    9. weather
    10. stars2
    11. upsidedown
    12. nathan
    13. cat smile
    14. old lady boobs
    15. glasses2
    16. religious
    17. sniperstars
    18. kokain
    19. bagel
    20. crying
    21. angry2
    22. 3
    23. 5
    24. fuck you
    25. head shot
    26. metal
    27. killer
    28. fu
    29. ankush
    30. owlkin

Changed

  • CLI art flag
  • CLI list flag

1.4 - 2018-06-14

Added

  • 15 new fonts
    1. letters
    2. lockergnome
    3. madrid
    4. marquee
    5. mike
    6. mini
    7. nancyj-fancy
    8. nancyj-underlined
    9. pepper
    10. poison
    11. rot13
    12. short
    13. small
    14. tengwar
    15. big
  • 11 new 1-line art
    1. teddy
    2. dice
    3. bee
    4. ukulele
    5. perky
    6. snail
    7. decorate
    8. kirby
    9. mango
    10. bunny
    11. kiss
  • random 1-line art mode

Changed

  • Minor bug in text2art random range fixed
  • README.md modified
  • aprint_test function renamed to art_list
  • setup.py modified

1.3 - 2018-06-08

Added

  • 10 new fonts
    1. eftitalic
    2. eftiwater
    3. fourtops
    4. goofy
    5. hollywood
    6. invita
    7. italic
    8. jazmine
    9. lcd
    10. lean
  • random font mode

1.2 - 2018-06-04

Added

  • 8 new fonts
    1. barbwire
    2. bigchief
    3. binary
    4. bubble
    5. calgphy2
    6. cygnet
    7. diamond
    8. eftifont

Changed

  • Test cases modified

1.1 - 2018-05-25

Added

  • 5 new fonts
    1. peaks
    2. pawp
    3. o8
    4. nipples
    5. maxfour
  • 15 new 1-line art
    1. guitar
    2. rocket
    3. ghost
    4. hal
    5. cthulhu
    6. sat
    7. what
    8. king
    9. tron
    10. homer
    11. fox
    12. singing
    13. atish
    14. zable
    15. trumpet
  • CLI description

Changed

  • README.md modified
  • Test cases modified
  • File name bug in UNIX fixed
  • CHANGELOG.md modified

1.0 - 2018-05-20

Added

  • 15 new fonts
    1. tinker-toy
    2. straight
    3. stampatello
    4. smslant
    5. smshadow
    6. smscript
    7. smkeyboard
    8. smisome1
    9. slscript
    10. slide
    11. sblood
    12. rozzo
    13. pyramid
    14. puffy
    15. pebbles
  • Typo-Tolerance system

Changed

  • README.md modified
  • Test cases modified

0.9 - 2018-05-08

Added

  • 10 new fonts
    1. weird
    2. univers
    3. twopoint
    4. trek
    5. tombstone
    6. threepoint
    7. thick
    8. tanja
    9. swan
    10. stellar

Changed

  • MANIFEST.in modified
  • INSTALL.md modified

0.8 - 2018-03-13

Added

  • CHANGELOG.md

Changed

  • Functions error response
  • README.md modified
  • tsave function extension bug fixed
  • text2art response bug fixed ("\r\n")
  • setup.py modified

0.7 - 2018-01-20

Added

  • 10 new fonts
    1. acrobatic
    2. alligator
    3. alligator2
    4. block2
    5. caligraphy
    6. computer
    7. digital
    8. doh
    9. eftirobot
    10. graffiti

0.6 - 2018-01-09

Added

  • all flag

0.5 - 2017-12-05

Added

  • 10 new fonts
    1. 3-d
    2. 3x5
    3. 5lineoblique
    4. alphabet
    5. banner3-D
    6. banner3
    7. banner4
    8. bell
    9. catwalk
    10. colossal

0.4 - 2017-11-11

Added

  • Telegram bot

Changed

  • Universal Text Format Added For Unix & Windows

0.3 - 2017-10-28

Added

  • Save function (tsave)
  • chr_ignore flag
  • 10 new fonts
    1. banner
    2. avatar
    3. basic
    4. bulbhead
    5. chunky
    6. coinstak
    7. contessa
    8. contrast
    9. cyberlarge
    10. cybermedium
    11. doom
    12. dotmatrix
    13. drpepper
    14. epic
    15. fuzzy
    16. isometric1
    17. isometric2
    18. isometric3
    19. isometric4
    20. larry3d
    21. nancyj
    22. ogre
    23. rectangles
    24. roman
    25. rounded
    26. rowancap
    27. script
    28. serifcap
    29. shadow
    30. slant
    31. speed
    32. starwars
    33. stop
    34. thin
    35. usaflag
  • overall_stat

Changed

  • Space bug fixed

0.2 - 2017-10-10

Added

  • Standard font

Changed

  • Minor bugs fixed

Changed

  • statistic_result to class_stat
  • params() to stat()

0.1 - 2017-10-04

Added

  • Block font
  • 1-Line art
  • CLI commands

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

art-2.1.tar.gz (275.9 kB view hashes)

Uploaded Source

Built Distribution

art-2.1-py2.py3-none-any.whl (252.6 kB view hashes)

Uploaded Python 2 Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page