Home > Enterprise >  How do you put text from a function into the table formatting in python?
How do you put text from a function into the table formatting in python?

Time:01-28

I'm trying to add my health bar into a table display, but I keep getting TypeError: unsupported format string passed to NoneType.__format__ I've looked it up and there's nothing on my specific problem. Here's the code:

def color(r, g, b, text):
    return "\033[38;2;{};{};{}m{} \033[38;2;255;255;255m".format(r, g, b, text)

def hp_bar(mxhp, hp, length):
    try:
        healthDisplay1 = ''
        dashConvert = int(mxhp/length)
        currentDashes = int(hp//dashConvert)
        remainingHealth = length - currentDashes
        barLength = round(dashConvert/8, 5)
        ramainder = int(hp           
  •  Tags:  
  • Related