Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Banner text
#1
Sharing a tool that a wrote that creates a uniform 'banner'.

I use use this for creating code block markers as well as banners for cli based apps, but use it how you will.

def banner(**args):
    if not args:
        print("Remember: do one thing and do it well.")
        return
    else:
        text = args['text']
        length = args['length']
    print("#", end='')
    if len(text) % 2:
        print(f"<{text}>".center(length, '='), end='')
    else:
        print(f"<{text}>".center(length + 1, '='), end='')
    print("#", end='')
    print()
    return


length = 44
print()

text = input("Banner text: ")
if text:
    banner(text=text, length=length)
else:
    banner()
Sig:
>>> import this

The UNIX philosophy: "Do one thing, and do it well."

"The danger of computers becoming like humans is not as great as the danger of humans becoming like computers." :~ Konrad Zuse

"Everything should be made as simple as possible, but not simpler." :~ Albert Einstein
Reply


Messages In This Thread
Banner text - by rob101 - Oct-22-2022, 09:08 AM
RE: Banner text - by rob101 - May-17-2023, 10:24 PM
RE: Banner text - by Gribouillis - May-18-2023, 09:26 AM
RE: Banner text - by rob101 - May-18-2023, 10:44 AM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020