From 3655c42dc985817850ad3b85ef607e365fff6180 Mon Sep 17 00:00:00 2001 From: jcdwalle Date: Wed, 3 Oct 2018 08:27:33 -0400 Subject: [PATCH 1/2] Create FramedText.py --- FramedText/FramedText.py | 55 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 FramedText/FramedText.py diff --git a/FramedText/FramedText.py b/FramedText/FramedText.py new file mode 100644 index 0000000..368efb0 --- /dev/null +++ b/FramedText/FramedText.py @@ -0,0 +1,55 @@ +import os +borderstyle = "║" + +def drawboxtext(dat): + height = len(dat) + y = 0 + while y < height: + dat[y] = " "+dat[y]+" " + y += 1 + width = len(max(dat, key=len))+1 + counter = 0 + x = 0 + line = "╔" + while x < width-1: + line = line + "═" + x += 1 + line = line + "╗" + print(line) + while counter < height: + reqspaces = width -1- len(dat[counter]) + xsp = "" + while reqspaces > 0: + xsp = xsp + " " + reqspaces -= 1 + print(borderstyle+dat[counter]+xsp+borderstyle) + counter += 1 + x = 0 + line = "╚" + while x < width-1: + line = line + "═" + x += 1 + line = line + "╝" + print(line) + + +print("Framed text generator by Julian Drake.\n") +print("") +while True: + print("Enter the items in the frame. (Leave blank to submit.)") + + items=[] + i=0 + while 1: + i+=1 + item=input('Enter item %d: '%i) + if item=="": + break + items.append(item) + + print("") + drawboxtext(items) + print("") + input("") + os.system('cls') + From 2ea1e7765df3507c0a4ab15bb0ede59066d94e92 Mon Sep 17 00:00:00 2001 From: jcdwalle Date: Wed, 3 Oct 2018 08:28:43 -0400 Subject: [PATCH 2/2] Create Readme.md --- FramedText/Readme.md | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 FramedText/Readme.md diff --git a/FramedText/Readme.md b/FramedText/Readme.md new file mode 100644 index 0000000..97077f1 --- /dev/null +++ b/FramedText/Readme.md @@ -0,0 +1,3 @@ +This is a simple Python script that will generate text with a neat border made from ASCII pipe characters. +Just run the script and input your lines of text, and it will print out the text with the border. +Enjoy! :D