Skip to main content

ASCII Art Library For Python

Project description

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.

 .----------------.  .----------------.  .----------------.
| .--------------. || .--------------. || .--------------. |
| |      __      | || |  _______     | || |  _________   | |
| |     /  \     | || | |_   __ \    | || | |  _   _  |  | |
| |    / /\ \    | || |   | |__) |   | || | |_/ | | \_|  | |
| |   / ____ \   | || |   |  __ /    | || |     | |      | |
| | _/ /    \ \_ | || |  _| |  \ \_  | || |    _| |_     | |
| ||____|  |____|| || | |____| |___| | || |   |_____|    | |
| |              | || |              | || |              | |
| '--------------' || '--------------' || '--------------' |
 '----------------'  '----------------'  '----------------'
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. ;-)

Downloads

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(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("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)


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

>>> 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سس',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 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
  • List of fonts : python -m art fonts
  • Test : python -m art test
  • Text : python -m art text yourtext fontname(optional)
  • Shape : python -m art shape 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

1.0 - 2018-05-20

Added

  • 15 new fonts
  • Typo-Tolerance system

Changed

  • README.md modified
  • Test cases modified

0.9 - 2018-05-08

Added

  • 10 new fonts

Changed

  • MANIFEST.in modified
  • INSTALL.md modified

0.8 - 2018-03-13

Added

  • CHANGELOG

Changed

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

0.7 - 2018-01-20

Added

  • 10 new fonts

0.6 - 2018-01-09

Added

  • all flag

0.5 - 2017-12-05

Added

  • 10 new fonts

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
  • 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-1.0.tar.gz (131.3 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

art-1.0-py3.4.egg (235.9 kB view details)

Uploaded Egg

art-1.0-py2.py3-none-any.whl (122.9 kB view details)

Uploaded Python 2Python 3

File details

Details for the file art-1.0.tar.gz.

File metadata

  • Download URL: art-1.0.tar.gz
  • Upload date:
  • Size: 131.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for art-1.0.tar.gz
Algorithm Hash digest
SHA256 33b3c864f6f75e83ebc5a12bee39780321d3e05fe92b0c77796eac6fe568f6e7
MD5 42b771311298f2a97cea220d79b7f399
BLAKE2b-256 1a5400b81ce206e25ac5240906ae7f4336b6987f81239987942745252a9531ef

See more details on using hashes here.

File details

Details for the file art-1.0-py3.4.egg.

File metadata

  • Download URL: art-1.0-py3.4.egg
  • Upload date:
  • Size: 235.9 kB
  • Tags: Egg
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for art-1.0-py3.4.egg
Algorithm Hash digest
SHA256 b6321e59962b70ae001f8dea7ddebfb70021409f2912623c61df9633191421b2
MD5 c147b5fba8067f9940655267fd3c1427
BLAKE2b-256 f529d6e28fc91498305b971001319f65d918e645489a30e5413312f7a8eba81c

See more details on using hashes here.

File details

Details for the file art-1.0-py2.py3-none-any.whl.

File metadata

  • Download URL: art-1.0-py2.py3-none-any.whl
  • Upload date:
  • Size: 122.9 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for art-1.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 fa946230f5bc353ce91dfb22a5f75cf0c4ddfdd48614d9a5b20d4a321a196307
MD5 fc756a75499874fe42cce4843cf8afd6
BLAKE2b-256 4b2c317c8876261f7bdbf0537db918d6df03f68dcdfdd195771e8af45c448e7d

See more details on using hashes here.

Supported by

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