PyQt supports rich text, essentially a subset of HTML that also includes some support for CSS (cascading style sheets).* This means that in practice, we can pass strings that contain HTML markup to many of PyQt’s text-handling classes and rely on PyQt to render the HTML properly in the user interface.
We have already seen examples of passing HTML to
QLabels. The graphics item class
QGraphicsTextItem can also accept HTML. The
QTextBrowser class supports basic HTML display including hyperlinks, and although it is by no means a full-blown Web browser, many developers find it sufficient for displaying help text. For editing HTML, PyQt provides the
QTextEdit class. Although this class ...