ASCII Art in Python with art library

Introduction

We will be using the art library to make ASCII Art in Python. This is a very simple library and also called ASCII art library for Python. ASCII Art is also known as computer text art. It involves the Intelligently arrangement of special characters and characters you type to create visual shapes that span multiple lines of text.

Installation

pip install art

Usage

Importing library

from art import *

Function to use to print ASCII art

tprint()

The first argument of tprint() function is the text we want to print, the second argument is the font name. Click here to check all the available fonts in the art library.

Examples

Example 1:

from art import *
tprint("test")

Output:

 _               _
| |_   ___  ___ | |_
| __| / _ \/ __|| __|
| |_ |  __/\__ \| |_
 \__| \___||___/ \__|

Example 2:

from art import *
tprint("test", font="bulbhead")

Output:

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

Example 3:

from art import *
tprint("test", font="random")

Output:

    .                          .
  .o8                        .o8
.o888oo  .ooooo.   .oooo.o .o888oo
  888   d88' `88b d88(  "8   888
  888   888ooo888 `"Y88b.    888
  888 . 888    .o o.  )88b   888 .
  "888" `Y8bod8P' 8""888P'   "888"

Example 4:

from art import *
tprint("test", font="random")

Output:

::::::::::: ::::::::::  ::::::::  :::::::::::
    :+:     :+:        :+:    :+:     :+:
    +:+     +:+        +:+            +:+
    +#+     +#++:++#   +#++:++#++     +#+
    +#+     +#+               +#+     +#+
    #+#     #+#        #+#    #+#     #+#
    ###     ##########  ########      ###

Example 5:

from art import *
tprint("test", font="random")

Output:

######   ######     ####   ######
                   #
#                   #      #
#        ######      #     #
#        #            #    #
#        #            #    #
 #####   ######   ####      #####

Example 6:

from art import *
tprint("copyassignment", font="random")

Output:

Output 1 for ASCII Art in Python

Example 7:

from art import *
tprint("copyassignment", font="random")

Output:

Output 2 for ASCII Art in Python

Example 8:

from art import *
tprint("copyassignment", font="random")

Output:

Output 3 for ASCII Art in Python

Conclusion

In this post, we learned how to use Python’s art library to create ASCII Art in Python. We have used the tprint() function to print ASCII art. There are two main arguments(the text we want to print and the font of the text) that we can pass to the tprint() function.

We hope you find this article on “ASCII Art in Python” helpful.


Also Read:

Share:

Author: Harry

Hello friends, thanks for visiting my website. I am a Python programmer. I, with some other members, write blogs on this website based on Python and Programming. We are still in the growing phase that's why the website design is not so good and there are many other things that need to be corrected in this website but I hope all these things will happen someday. But, till then we will not stop ourselves from uploading more amazing articles. If you want to join us or have any queries, you can mail me at admin@copyassignment.com Thank you