Merge pull request #16 from jcdwalle/master

Added a framed text generator
This commit is contained in:
Kaushlendra Pratap 2018-10-03 19:27:02 +05:30 committed by GitHub
commit d60e41a8e4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 58 additions and 0 deletions

55
FramedText/FramedText.py Normal file
View File

@ -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')

3
FramedText/Readme.md Normal file
View File

@ -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