python+pyfiglet: arte de palabras ASCII

La fuente Figlet no es compatible con chino

from pyfiglet import FigletFont, Figlet
from colorama import Fore, Back, Style


def pyfiglet_demo(text='Hello'):
    # 打印slant类型的艺术字
    ft = Figlet(font='slant')
    print(ft.renderText(text))
    print(Fore.RED + Back.BLACK + ft.renderText(text))
    print(Fore.GREEN + Back.BLACK + Style.BRIGHT + ft.renderText(text))


def show_all(text='Hello'):
    # 通过获取所有字体类型,打印出所有类型艺术字体
    for font in FigletFont().getFonts():
        print(Fore.GREEN + Back.BLACK + Style.BRIGHT + Figlet(font).renderText(text), f'=========={font}=========' * 5)


if __name__ == '__main__':
    text = 'Python'
    pyfiglet_demo()
    # show_all(text)

  

Supongo que te gusta

Origin blog.csdn.net/JBY2020/article/details/128482565
Recomendado
Clasificación