Sitemap

Font Art With Python

2 min readAug 7, 2022

--

Press enter or click to view image in full size
Create Font Art using python

Do you like adding some art or some personalization to your code?

Here is something you going to like, and can try in python.

Get Mister Diallo’s stories in your inbox

Join Medium for free to get updates from this writer.

Find the Code Source on 👉🏼my Github👈🏻.

The python library we are going to use is Pyfiglet.

For the definitions stuff, What is PyFiglet?

Pyfiglet is a full port of FIGlet (http://www.figlet.org/) into pure
python. It takes ASCII text and renders it in ASCII art fonts (like
the title above, which is the ‘block’ font).

Now let’s try it!

  1. To use PyFiglet and Write nice font art, we should install it on our machine, by doing this:
pip install pyfiglet

2. Like every other python library, we should import it to be able to use it:

import pyfiglet

3. Then we create our font art in a variable font with the import library by adding the text we want to display:

font = pyfiglet.figlet_format("For Fun")

4. And Finally, we display it by print:

print(font) _____            _____            
| ___|__ _ __ | ___| _ _ __
| |_ / _ \| '__| | |_ | | | | '_ \
| _| (_) | | | _|| |_| | | | |
|_| \___/|_| |_| \__,_|_| |_|

Easy and Nice right ?

Let’s make it more fun by changing the font art type.

Just by adding the property font with the name of the art type as value.

font = pyfiglet.figlet_format("For Fun", font="univers")
print(font)
88888888888 88888888888
88 88
88 88
88aaaaa ,adPPYba, 8b,dPPYba, 88aaaaa 88 88 8b,dPPYba,
88""""" a8" "8a 88P' "Y8 88""""" 88 88 88P' `"8a
88 8b d8 88 88 88 88 88 88
88 "8a, ,a8" 88 88 "8a, ,a88 88 88
88 `"YbbdP"' 88 88 `"YbbdP'Y8 88 88

Let’s try another one:

font = pyfiglet.figlet_format("For Fun", font="larry3d")
print(font)
____ ____
/\ _`\ /\ _`\
\ \ \L\_\___ _ __ \ \ \L\_\__ __ ___
\ \ _\/ __`\/\`'__\ \ \ _\/\ \/\ \ /' _ `\
\ \ \/\ \L\ \ \ \/ \ \ \/\ \ \_\ \/\ \/\ \
\ \_\ \____/\ \_\ \ \_\ \ \____/\ \_\ \_\
\/_/\/___/ \/_/ \/_/ \/___/ \/_/\/_/

IF you want to all the possible are policies, check this link.

That was all I wanted to share with you.

Find the Code Source on 👉🏼my Github👈🏻.

Thank you.

--

--

Mister Diallo
Mister Diallo

Written by Mister Diallo

Flutter (frontend), Spring (backend) developer and Data Scientist passionate about changing complex data into clear stories. From Guinea (living in China)