Hola es que ando haciendo un istalador y quiero hacer que si la linea tiene mucho caracteres pueda bajar y mantener el cuadro bien
Código Python:
Ver original#!/usr/bin/python3
# -*- coding: utf-8 -*-
import os
class col:
HEADER = '\033[95m'
OKBLUE = '\033[94m'
OKGREEN = '\033[92m'
WARNING = '\033[93m'
FAIL = '\033[91m'
ENDC = '\033[0m'
BOLD = '\033[1m'
UNDERLINE = '\033[4m'
def getVersion():
try: return os.popen("lsb_release -d").read().split(":")[-1].strip()
except: return ""
def printc(rText, rColour=col.OKBLUE, rPadding=0, rLimit=46):
print("%s ┌─────────────────────────────────────────────────┐ %s" % (rColour, col.ENDC))
for i in range(rPadding): print("%s │ │ %s" % (rColour, col.ENDC))
array = [rText[i:i+rLimit] for i in range(0, len(rText), rLimit)]
for i in array : print("%s │ %s%s%s │ %s" % (rColour, " "*round(23-(len(rText)/2)), i, " "*round(46-(22-(len(rText)/2))-len(rText)), col.ENDC))
#print("%s │ %s%s%s │ %s" % (rColour, " "*round(23-(len(rText)/2)), rText, " "*round(46-(22-(len(rText)/2))-len(rText)), col.ENDC))
for i in range(rPadding): print("%s │ │ %s" % (rColour, col.ENDC))
print("%s └─────────────────────────────────────────────────┘ %s" % (rColour, col.ENDC))
print(" ")
if __name__ == "__main__":
printc("Intalator Auto BETA - Installer %s " % getVersion(), col.OKGREEN, 2)
print(" ")