Search code examples
pyqt4qt4ansi-c

Render ANSI colour with Qt4?


I would like to render ANSI colour with Qt4 in a QLabel or QTextEdit or anything else that would do.

Right now the QLabel(""\033[94m HELLO \033[0m"") renders the string as is.

How can I render ANSI colour or what is a good alternative in Qt4?


Solution

  • You would need to parse the string. A QLabel is either going to display plain text or html. That means you will need to transform it into html spans most likely.