스타일을 Python 콘솔로

Python 콘솔은 꽤 둔해 보이지 않습니까?



글쎄, 나는 당신이 파이썬 콘솔에 스타일을 추가할 수 있는 방법을 알고 있다...



  _   _   _   _   _   _   _   _  
 / \ / \ / \ / \ / \ / \ / \ / \ 
( P | y | F | i | g | l | e | t )
 \_/ \_/ \_/ \_/ \_/ \_/ \_/ \_/ 






oOoOOoOOo         o     o                   .oOo 
    o            O     O                    O    
    o            O     o                    o    
    O            o     O                    OoO  
    o     .oOoO' OoOo. o  .oOo.       .oOo. o    
    O     O   o  O   o O  OooO'       O   o O    
    O     o   O  o   O o  O           o   O o    
    o'    `OoO'o `OoO' Oo `OoO'       `OoO' O'   


 .oOOOo.                                              
.O     o                                              
o                        O                  O         
o                       oOo                oOo        
o         .oOo. 'OoOo.   o   .oOo. 'OoOo.   o   .oOo  
O         O   o  o   O   O   OooO'  o   O   O   `Ooo. 
`o     .o o   O  O   o   o   O      O   o   o       O 
 `OoooO'  `OoO'  o   O   `oO `OoO'  o   O   `oO `OoO' 


Introduction
Setting it up
Some fonts in PyFiglet
Conclusion

소개

The PyFiglet modules takes ASCII text and converts it to cool ASCII art fonts. The function Figlet in the PyFiglet module is used to set a font, so you can easily render it.

설정

The command to install the PyFiglet module is:

pip install pyfiglet

Then, wherever you are writing your code, import PyFiglet, by doing what it shows below:

import pyfiglet

To set up your font, you have to do the code below, obviously replacing the [font_name] with an actual font name in PyFiglet:

f = Figlet(font='[font_name]')

The font argument is optional, and if you don't mention it when declaring the argument, your class called f will have the standard font.

To show your text with the ASCII art fonts, you will have to use the function renderText in the class f , like below:

print(f.renderText('looks cool'))

PyFiglet의 일부 글꼴

There are 425 different fonts in PyFiglet, and you can see all their names by doing the code below:

from pyfiglet import FigletFont
print(FigletFont.getFonts())

But to save you some time, I'm going to go through the fonts in PyFiglet which I think stand out.

  • standard

The standard is one of the best fonts, especially if it's the first ASCII art font you see.

 _             _                          _ 
| | ___   ___ | | _____    ___ ___   ___ | |
| |/ _ \ / _ \| |/ / __|  / __/ _ \ / _ \| |
| | (_) | (_) |   <\__ \ | (_| (_) | (_) | |
|_|\___/ \___/|_|\_\___/  \___\___/ \___/|_|
  • weird

The weird font is just supposed to look weird, I guess.

/           /                             /
(  ___  ___ (     ___       ___  ___  ___ ( 
| |   )|   )|___)|___      |    |   )|   )| 
| |__/ |__/ | \   __/      |__  |__/ |__/ | 
  • wavy

The wavy font is pretty wavy.

 ) _   _ ( _  _    _  _   _   ) 
( (_) (_) )\ (    (_ (_) (_) (  
             _)                 
  • univers

The univers font has it's name spelt wrong, but it looks nice.

88                         88                   
88                         88                   
88                         88                   
88  ,adPPYba,   ,adPPYba,  88   ,d8  ,adPPYba,  
88 a8"     "8a a8"     "8a 88 ,a8"   I8[    ""  
88 8b       d8 8b       d8 8888[      `"Y8ba,   
88 "8a,   ,a8" "8a,   ,a8" 88`"Yba,  aa    ]8I  
88  `"YbbdP"'   `"YbbdP"'  88   `Y8a `"YbbdP"'  



                                   88  
                                   88  
                                   88  
 ,adPPYba,  ,adPPYba,   ,adPPYba,  88  
a8"     "" a8"     "8a a8"     "8a 88  
8b         8b       d8 8b       d8 88  
"8a,   ,aa "8a,   ,a8" "8a,   ,a8" 88  
 `"Ybbd8"'  `"YbbdP"'   `"YbbdP"'  88  
  • type_set

The type_set font just uses hashtags to make art which looks very similar to letters.

#      ##     ##   #    # ####      ###   ##     ##   #       
 #     #  #   #  #  #   # #    #    #   # #  #   #  #  #       
 #    #    # #    # #  #  #        #     #    # #    # #       
 #    #    # #    # ###    ####    #     #    # #    # #       
 #    #    # #    # #  #       #   #     #    # #    # #       
 #     #  #   #  #  #   # #    #    #   # #  #   #  #  #       
 ###### ##     ##   #    # ####      ###   ##     ##   ###### 
  • tombstone

The tombstone font uses tildas for the base and underscores and apostrophes for the top.

 _,   _,  _, _,_  _,    _,  _,  _, _, 
 |   / \ / \ |_/ (_    / ` / \ / \ |  
 | , \ / \ / | \ , )   \ , \ / \ / | ,
 ~~~  ~   ~  ~ ~  ~     ~   ~   ~  ~~~
  • stop .

The stop font makes the words look bubbly.

 _             _                              _ 
| |           | |                            | |
| | ___   ___ | |  _  ___     ____ ___   ___ | |
| |/ _ \ / _ \| | / )/___)   / ___) _ \ / _ \| |
| | |_| | |_| | |< (|___ |  ( (__| |_| | |_| | |
|_|\___/ \___/|_| \_|___/    \____)___/ \___/|_|
  • threepoint

The threepoint font makes the words look pointy. It looks similar to the twopoint font.

| _  _ |  _   _ _  _ |
|(_)(_)|<_\  (_(_)(_)|
  • starwars

The starwars font makes the words look like the words in the introduction of star wars.

 __        ______     ______    __  ___      _______.
|  |      /  __  \   /  __  \  |  |/  /     /       |
|  |     |  |  |  | |  |  |  | |  '  /     |   (----`
|  |     |  |  |  | |  |  |  | |    <       \   \    
|  `----.|  `--'  | |  `--'  | |  .  \  .----)   |   
|_______| \______/   \______/  |__|\__\ |_______/    

  ______   ______     ______    __      
 /      | /  __  \   /  __  \  |  |     
|  ,----'|  |  |  | |  |  |  | |  |     
|  |     |  |  |  | |  |  |  | |  |     
|  `----.|  `--'  | |  `--'  | |  `----.
 \______| \______/   \______/  |_______|
  • slant

The slant font makes the words look slant. As simple as that.

    __            __                            __
   / /___  ____  / /_______   _________  ____  / /
  / / __ \/ __ \/ //_/ ___/  / ___/ __ \/ __ \/ / 
 / / /_/ / /_/ / ,< (__  )  / /__/ /_/ / /_/ / /  
/_/\____/\____/_/|_/____/   \___/\____/\____/_/   
  • smkeyboard

The smkeyboard font makes the letters look like they are the keys of a keyboard.

 ____ ____ ____ ____ ____ _________ ____ ____ ____ ____ 
||l |||o |||o |||k |||s |||       |||c |||o |||o |||l ||
||__|||__|||__|||__|||__|||_______|||__|||__|||__|||__||
|/__\|/__\|/__\|/__\|/__\|/_______\|/__\|/__\|/__\|/__\|
  • isometric1

The isometric1 font makes the words look isometric.

      ___       ___           ___           ___           ___     
     /\__\     /\  \         /\  \         /\__\         /\  \    
    /:/  /    /::\  \       /::\  \       /:/  /        /::\  \   
   /:/  /    /:/\:\  \     /:/\:\  \     /:/__/        /:/\ \  \  
  /:/  /    /:/  \:\  \   /:/  \:\  \   /::\__\____   _\:\~\ \  \ 
 /:/__/    /:/__/ \:\__\ /:/__/ \:\__\ /:/\:::::\__\ /\ \:\ \ \__\
 \:\  \    \:\  \ /:/  / \:\  \ /:/  / \/_|:|~~|~    \:\ \:\ \/__/
  \:\  \    \:\  /:/  /   \:\  /:/  /     |:|  |      \:\ \:\__\  
   \:\  \    \:\/:/  /     \:\/:/  /      |:|  |       \:\/:/  /  
    \:\__\    \::/  /       \::/  /       |:|  |        \::/  /   
     \/__/     \/__/         \/__/         \|__|         \/__/    
      ___           ___           ___           ___ 
     /\  \         /\  \         /\  \         /\__\
    /::\  \       /::\  \       /::\  \       /:/  /
   /:/\:\  \     /:/\:\  \     /:/\:\  \     /:/  / 
  /:/  \:\  \   /:/  \:\  \   /:/  \:\  \   /:/  /  
 /:/__/ \:\__\ /:/__/ \:\__\ /:/__/ \:\__\ /:/__/   
 \:\  \  \/__/ \:\  \ /:/  / \:\  \ /:/  / \:\  \   
  \:\  \        \:\  /:/  /   \:\  /:/  /   \:\  \  
   \:\  \        \:\/:/  /     \:\/:/  /     \:\  \ 
    \:\__\        \::/  /       \::/  /       \:\__\
     \/__/         \/__/         \/__/         \/__/
  • shimrod

The shimrod font makes the words look elongated.

.         ,                     . 
|         |                     | 
| ,-. ,-. | , ,-.   ,-. ,-. ,-. | 
| | | | | |<  `-.   |   | | | | | 
' `-' `-' ' ` `-'   `-' `-' `-' ' 
  • serifcap

The serifcap font makes the words look floaty and bubbly.

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

The xcour font makes the words look fancy just with hashtags.

 ##             ##                           ##   
  #              #                            #   
  #    ##   ##   # ##  ###    ##   ##   ##    #   
  #   #  # #  #  # #  #      #  # #  # #  #   #   
  #   #  # #  #  ##    ##    #    #  # #  #   #   
  #   #  # #  #  # #     #   #  # #  # #  #   #   
#####  ##   ##  ## ## ###     ##   ##   ##  ##### 
  • poison

The poison font makes the words look like poison dripping on them.

@@@        @@@@@@    @@@@@@   @@@  @@@   @@@@@@   
@@@       @@@@@@@@  @@@@@@@@  @@@  @@@  @@@@@@@   
@@!       @@!  @@@  @@!  @@@  @@!  !@@  !@@       
!@!       !@!  @!@  !@!  @!@  !@!  @!!  !@!       
@!!       @!@  !@!  @!@  !@!  @!@@!@!   !!@@!!    
!!!       !@!  !!!  !@!  !!!  !!@!!!     !!@!!!   
!!:       !!:  !!!  !!:  !!!  !!: :!!        !:!  
 :!:      :!:  !:!  :!:  !:!  :!:  !:!      !:!   
 :: ::::  ::::: ::  ::::: ::   ::  :::  :::: ::   
: :: : :   : :  :    : :  :    :   :::  :: : :    


 @@@@@@@   @@@@@@    @@@@@@   @@@       
@@@@@@@@  @@@@@@@@  @@@@@@@@  @@@       
!@@       @@!  @@@  @@!  @@@  @@!       
!@!       !@!  @!@  !@!  @!@  !@!       
!@!       @!@  !@!  @!@  !@!  @!!       
!!!       !@!  !!!  !@!  !!!  !!!       
:!!       !!:  !!!  !!:  !!!  !!:       
:!:       :!:  !:!  :!:  !:!   :!:      
 ::: :::  ::::: ::  ::::: ::   :: ::::  
 :: :: :   : :  :    : :  :   : :: : : 
  • linux

The linux font makes the words look really bubbly (and linuxy)

.-.   .----..----..-.,-..---. .---..----..----..-.   
| |__ | || || || || . <  \ \  | |  | || || || || |__ 
`----'`----'`----'`-'`-'`---' `---'`----'`----'`----'
  • gothic

Yes you guessed it right. The gothic font makes the words look gothic-like.

,,             ,,                                ,, 
||             ||                                || 
||  /'\\  /'\\ ||/\  _-_,        _-_  /'\\  /'\\ || 
|| || || || || ||_< ||_.        ||   || || || || || 
|| || || || || || |  ~ ||       ||   || || || || || 
\\ \\,/  \\,/  \\,\ ,-_-        \\,/ \\,/  \\,/  \\ 
  • fuzzy

The fuzzy font makes the words look fuzzy and bubbly.

.-.              .-.                             .-.  
: :              : :.-.                          : :  
: :   .--.  .--. : `'.' .--.    .--.  .--.  .--. : :  
: :_ ' .; :' .; :: . `.`._-.'  '  ..'' .; :' .; :: :_ 
`.__;`.__.'`.__.':_;:_;`.__.'  `.__.'`.__.'`.__.'`.__;
  • fender

The fender font makes the words look straighter.

'||`               '||                                   '||` 
 ||                 ||                                    ||  
 ||  .|''|, .|''|,  || //`  (''''    .|'', .|''|, .|''|,  ||  
 ||  ||  || ||  ||  ||<<     `'')    ||    ||  || ||  ||  ||  
.||. `|..|' `|..|' .|| \\.  `...'    `|..' `|..|' `|..|' .||. 
  • epic

The epic font makes the words look medieval.

 _        _______  _______  _        _______ 
( \      (  ___  )(  ___  )| \    /\(  ____ \
| (      | (   ) || (   ) ||  \  / /| (    \/
| |      | |   | || |   | ||  (_/ / | (_____ 
| |      | |   | || |   | ||   _ (  (_____  )
| |      | |   | || |   | ||  ( \ \       ) |
| (____/\| (___) || (___) ||  /  \ \/\____) |
(_______/(_______)(_______)|_/    \/\_______)

 _______  _______  _______  _       
(  ____ \(  ___  )(  ___  )( \      
| (    \/| (   ) || (   ) || (      
| |      | |   | || |   | || |      
| |      | |   | || |   | || |      
| |      | |   | || |   | || |      
| (____/\| (___) || (___) || (____/\
(_______/(_______)(_______)(_______/
  • dotmatrix

The dotmatrix font makes the words look dotty.

 _  _                                  _                         
(_)(_)                                (_)                        
   (_)      _  _  _        _  _  _    (_)     _   _  _  _  _     
   (_)   _ (_)(_)(_) _  _ (_)(_)(_) _ (_)   _(_)_(_)(_)(_)(_)    
   (_)  (_)         (_)(_)         (_)(_) _(_) (_)_  _  _  _     
   (_)  (_)         (_)(_)         (_)(_)(_)_    (_)(_)(_)(_)_   
 _ (_) _(_) _  _  _ (_)(_) _  _  _ (_)(_)  (_)_   _  _  _  _(_)  
(_)(_)(_)  (_)(_)(_)      (_)(_)(_)   (_)    (_) (_)(_)(_)(_)    


                                        _  _          
                                       (_)(_)         
   _  _  _    _  _  _        _  _  _      (_)         
 _(_)(_)(_)_ (_)(_)(_) _  _ (_)(_)(_) _   (_)         
(_)       (_)         (_)(_)         (_)  (_)         
(_)       (_)         (_)(_)         (_)  (_)         
(_)_  _  _(_) _  _  _ (_)(_) _  _  _ (_)_ (_) _       
  (_)(_)(_)  (_)(_)(_)      (_)(_)(_)  (_)(_)(_)    
  • caligraphy

The caligraphy font is a bit like the gothic font, but more bigger, pointier and it only uses asterisks.

***                             *                   
 ***                          **                    
  **                          **                    
  **                          **                    
  **       ****       ****    **            ****    
  **      * ***  *   * ***  * **  ***      * **** * 
  **     *   ****   *   ****  ** * ***    **  ****  
  **    **    **   **    **   ***   *    ****       
  **    **    **   **    **   **   *       ***      
  **    **    **   **    **   **  *          ***    
  **    **    **   **    **   ** **            ***  
  **    **    **   **    **   ******      ****  **  
  **     ******     ******    **  ***    * **** *   
  *** *   ****       ****     **   *** *    ****    
   ***                         **   ***             






                                 ***     
                                  ***    
                                   **    
                                   **    
              ****       ****      **    
   ****      * ***  *   * ***  *   **    
  * ***  *  *   ****   *   ****    **    
 *   ****  **    **   **    **     **    
**         **    **   **    **     **    
**         **    **   **    **     **    
**         **    **   **    **     **    
**         **    **   **    **     **    
***     *   ******     ******      **    
 *******     ****       ****       *** * 
  *****                             *** 
  • avatar

The avatar font is like the epic font, but a bit more smaller and pointier.

 _     ____  ____  _  __ ____    ____ ____  ____  _    
/ \   /  _ \/  _ \/ |/ // ___\  /   _Y  _ \/  _ \/ \   
| |   | / \|| / \||   / |    \  |  / | / \|| / \|| |   
| |_/\| \_/|| \_/||   \ \___ |  |  \_| \_/|| \_/|| |_/\
\____/\____/\____/\_|\_\\____/  \____|____/\____/\____/
  • broadway

The broadway font on PyFiglet, looks a lot like the actual font, but it uses a lot of 8s.

8 8888         ,o888888o.         ,o888888o.     8 8888     ,88'   d888888o.   
8 8888      . 8888     `88.    . 8888     `88.   8 8888    ,88'  .`8888:' `88. 
8 8888     ,8 8888       `8b  ,8 8888       `8b  8 8888   ,88'   8.`8888.   Y8 
8 8888     88 8888        `8b 88 8888        `8b 8 8888  ,88'    `8.`8888.     
8 8888     88 8888         88 88 8888         88 8 8888 ,88'      `8.`8888.    
8 8888     88 8888         88 88 8888         88 8 8888 88'        `8.`8888.   
8 8888     88 8888        ,8P 88 8888        ,8P 8 888888<          `8.`8888.  
8 8888     `8 8888       ,8P  `8 8888       ,8P  8 8888 `Y8.    8b   `8.`8888. 
8 8888      ` 8888     ,88'    ` 8888     ,88'   8 8888   `Y8.  `8b.  ;8.`8888 
8 888888888888 `8888888P'         `8888888P'     8 8888     `Y8. `Y8888P ,88P' 

    ,o888888o.        ,o888888o.         ,o888888o.     8 8888         
   8888     `88.   . 8888     `88.    . 8888     `88.   8 8888         
,8 8888       `8. ,8 8888       `8b  ,8 8888       `8b  8 8888         
88 8888           88 8888        `8b 88 8888        `8b 8 8888         
88 8888           88 8888         88 88 8888         88 8 8888         
88 8888           88 8888         88 88 8888         88 8 8888         
88 8888           88 8888        ,8P 88 8888        ,8P 8 8888         
`8 8888       .8' `8 8888       ,8P  `8 8888       ,8P  8 8888         
   8888     ,88'   ` 8888     ,88'    ` 8888     ,88'   8 8888         
    `8888888P'        `8888888P'         `8888888P'     8 888888888888 

결론

The Python console can look a bit dull sometimes, but if you add in some effort, you can make it look great!

Hope you enjoyed reading this and learnt something new.

CAN YOU FIND WHICH FONTS ARE BEING USED IN THE HEADERS???

좋은 웹페이지 즐겨찾기