Search code examples
pythonfontspycharmoutputascii

Pyfiglet/Python - Print Pyfiglet ASCII in one line


This is my code to print "x t e k k y" whit a cool ASCII font using pyfiglet, but the output always displays in 2 lines, whith gives a bad aestethic, is there any way to fix that?

from pyfiglet import figlet_format
from termcolor import colored

art = figlet_format("x t e k k y", font='alligator')
c_art = colored(art, 'blue')

print(c_art)

output: enter image description here


Solution

  • set the width property in the format like so

    art = figlet_format("x t e k k y", font='alligator', width=110)
    

    Adjust the width until it prints all on one line. The wider the width the wider the 'page' you are printing on. Happy coding!