I am trying to display a fragment of the string in the desired color. I set the color in the format method. It is displayed only in the print () function. Why is not displayed in the rows of PyQt5 widgets? 
from PyQt5.QtWidgets import QApplication, QWidget, QVBoxLayout, QTextEdit, QLabel import sys app = QApplication(sys.argv) window = QWidget() window.resize(300, 100) word = "{blue}{0}{endcolor} {1}"\ .format("-ABC def-", "1111", blue='\033[96m', endcolor='\033[0m') print(word) txt = QTextEdit(word) lbl = QLabel(word) vbox = QVBoxLayout() vbox.addWidget(txt) vbox.addWidget(lbl) window.setLayout(vbox) window.show() sys.exit(app.exec_()) 