It came up with an error saying “TypeError: cannot concatenate ‘str’ and ‘tuple’ objects”. Does anyone know how to do what I’m trying to do? Thanks
This question is unclear and not Pi specific (and this answer does not address the python coding errors).
The following python code fragment is an example of how to display coloured text on a console using ANSI escape codes. This works on ANY platform, it may or may not work on a SenseHat.
RED = "\033[1;31m" RESET = "\033[0;0m" def pRed(s): print("%s%s%s" % (RED, s, RESET), file=sys.stderr) def perr(l): pRed("%s - Error on line %d:" % (l, lineno))
Try using the ANSI escape code:
"\033[1;32;40m Bright Green"
The above ANSI escape code will set the text colour to bright green. The format is: \033[ Escape code, this is always the same 1 = Style, 1 for normal. 32 = Text colour, 32 for bright green. 40m = Background colour, 40 is for black.
You can get the color codes here