make beatufuil output in idle shell in python

main.py
# You can make the output in the Python IDLE shell more beautiful by using functions like print() and formatting the text. 
# You can control the appearance by adding colors, styles, or formatting to the text.

# Example of making beautiful output in the IDLE shell:
def print_colored_text(text, color):
    colors = {
        'red': '\033[91m',
        'green': '\033[92m',
        'blue': '\033[94m',
        'yellow': '\033[93m',
        'pink': '\033[95m',
        'bold': '\033[1m',
        'underline': '\033[4m',
        'end': '\033[0m'
    }
    color_str = colors.get(color.lower(), '')
    if color_str:
        print(f"{color_str}{text}{colors['end']}")
    else:
        print(text)

print_colored_text("This is a beautiful output in red color", 'red')
print_colored_text("This is a beautiful output in green color", 'green')
print_colored_text("This is a beautiful output in blue color", 'blue')
print_colored_text("This is a beautiful output in bold style", 'bold')
981 chars
26 lines

In the above example, the print_colored_text function will print text in different colors or styles. You can adjust the function to include more colors or styles as per your requirements.

related categories

gistlibby LogSnag