31 Текстовый интерфейс выравниванием

Run Settings
LanguagePython
Language Version
Run Command
import os def color_text(text, color): """Окрашивает текст в заданный цвет ANSI""" color_code = "" reset_code = "\033[0m" if color == 'red': color_code = "\033[31m" elif color == 'white': color_code = "\033[37m" elif color == 'blue': color_code = "\033[34m" elif color == 'yellow': color_code = "\033[33m" elif color == 'green': color_code = "\033[32m" elif color == 'pink': color_code = "\033[95m" return f"{color_code}{text}{reset_code}" os.system("cls") equals_left = color_text("=", "red") + color_text("=", "white") + color_text("=", "blue") equals_right = color_text("=", "blue") + color_text("=", "white") + color_text("=", "red") title = f"{equals_left: >40} {color_text('Music App', 'yellow')} {equals_right}" print(f"{title}\n") song_name = color_text("Radio Gaga", "white") song_line = f"🔥 ▶\t{song_name}" print(song_line) artist_name = color_text("Queen", "yellow") print(f"\t{artist_name:}") print("\n") prev_t = color_text("PREV", "white") next_t = color_text("NEXT", "green") pause_t = color_text("PAUSE", "pink") print(f"{prev_t}") print(f"\t{next_t}") print(f"\t\t{pause_t}") print("\n\n") # ================ часть 2 ================ # title1 = color_text("WELCOME TO", "white") print(f"{title1:^35}") title2 = color_text("-- ARMBOOK --", "blue") print(f"{title2:^35}") line = color_text("Definitely not a rip off", "yellow") print(f"{line:>35}") line = color_text("a certain other social", "yellow") print(f"{line:>35}") line = color_text("networking site", "yellow") print(f"{line:>35}\n") line = color_text("Honest.", "red") print(f"{line:^35}\n") line = color_text("Username:", "white") print(f"{line:^35}") line = color_text("Password:", "white") print(f"{line:^35}")
Editor Settings
Theme
Key bindings
Full width
Lines