billythegoat356 / pystyle

The source of my Python library, pystyle.
https://pypi.org/project/pystyle/
Eclipse Public License 2.0
202 stars 13 forks source link

Center Text inside doublebox #5

Open FuckingToasters opened 2 years ago

FuckingToasters commented 2 years ago

Hello, i tried multiplie things but im somehow not able to center Text inside a double box. everytime i try it the box becomes too large, the whole box with the text inside is centered etc. but the thing i actually want is that the box stay the same without being centerd and only the text inside the box should be centerd.

def banner():
    logo = r"""
    ███████╗ ██████╗ ██████╗ ██╗   ██╗███╗   ███╗    ████████╗ ██████╗  ██████╗ ██╗     ███████╗
    ██╔════╝██╔═══██╗██╔══██╗██║   ██║████╗ ████║    ╚══██╔══╝██╔═══██╗██╔═══██╗██║     ██╔════╝
    █████╗  ██║   ██║██████╔╝██║   ██║██╔████╔██║       ██║   ██║   ██║██║   ██║██║     ███████╗
    ██╔══╝  ██║   ██║██╔══██╗██║   ██║██║╚██╔╝██║       ██║   ██║   ██║██║   ██║██║     ╚════██║
    ██║     ╚██████╔╝██║  ██║╚██████╔╝██║ ╚═╝ ██║       ██║   ╚██████╔╝╚██████╔╝███████╗███████║
    ╚═╝      ╚═════╝ ╚═╝  ╚═╝ ╚═════╝ ╚═╝     ╚═╝       ╚═╝    ╚═════╝  ╚═════╝ ╚══════╝╚══════╝                                  
    """
    # Write.Print(Box.DoubleCube(Center.Center(logo)), Colors.blue_to_green, interval=0.00)
    Anime.Fade(Box.DoubleCube(Center.XCenter(logo)), Colors.red_to_purple, Colorate.Vertical, interval=0.025, enter=False)

banner()

grafik

billythegoat356 commented 2 years ago

Hello The text should be centered by default.

Try removing this space: it could be causing the problem image

FuckingToasters commented 2 years ago

@billythegoat356 Hello, I now have an similar issue. I started using this libary again but what now happen is, that the banner is printed a lot and the input won't even popup:

import os
import pystyle
def logo():
    font = """
        ███╗   ██╗██╗████████╗██████╗  ██████╗     ██████╗ ███████╗██████╗ ███████╗███████╗███╗   ███╗███████╗██████╗     
        ████╗  ██║██║╚══██╔══╝██╔══██╗██╔═══██╗    ██╔══██╗██╔════╝██╔══██╗██╔════╝██╔════╝████╗ ████║██╔════╝██╔══██╗    
        ██╔██╗ ██║██║   ██║   ██████╔╝██║   ██║    ██████╔╝█████╗  ██║  ██║█████╗  █████╗  ██╔████╔██║█████╗  ██████╔╝    
        ██║╚██╗██║██║   ██║   ██╔══██╗██║   ██║    ██╔══██╗██╔══╝  ██║  ██║██╔══╝  ██╔══╝  ██║╚██╔╝██║██╔══╝  ██╔══██╗    
        ██║ ╚████║██║   ██║   ██║  ██║╚██████╔╝    ██║  ██║███████╗██████╔╝███████╗███████╗██║ ╚═╝ ██║███████╗██║  ██║    
        ╚═╝  ╚═══╝╚═╝   ╚═╝   ╚═╝  ╚═╝ ╚═════╝     ╚═╝  ╚═╝╚══════╝╚═════╝ ╚══════╝╚══════╝╚═╝     ╚═╝╚══════╝╚═╝  ╚═╝    
    """

    menu = """
        [01] Classic Nitro
        [02] Soon
        [03] Soon
        [04] Soon
        [05] Soon
    """
    # Anime.Fade(Box.DoubleCube(Center.XCenter(logo)), Colors.red_to_purple, Colorate.Vertical, interval=0.025, enter=False)
    pystyle.Anime.Fade(pystyle.Center.XCenter(f"{pystyle.Box.DoubleCube(font)}\n{menu}"), pystyle.Colors.red_to_purple,  pystyle.Colorate.Vertical, interval=0.1)
    # print(f"{font}\n{menu}")
    option = pystyle.Write.Print("\t\t[*] Select an option: ", pystyle.Colors.red_to_purple, interval=0.05)

    if option != "1" and option != "2" and option != "3" and option != "4" and option != "5":
        print("\t\t[!] Invalid option")
        os.system("cls" if os.name == "nt" else "clear")
        logo()

    return option

billythegoat356 commented 2 years ago

its because you animated it, dont use Anime