S
S
serkom2017-10-02 18:23:20
Python
serkom, 2017-10-02 18:23:20

How to output HTML with highlighting of some tags in PyQt?

I am making a program using PyQt5. One of the features is HTML output with highlighting some tags in different colors. Each new line is processed and added via .append. Clearly, the field of the QTextEdit class does not suit me, since pure HTML output is required. The way out is to use the fields of the QPlainTextEdit class. But here the problem is in the application of color - I can no longer use font tags, QPlainTextEdit assumes the output of pure text without applying color. Escaping tags in QTextEdit is not a good idea. Applying color to the entire field is also not at all suitable.
How to get out of this situation?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
saw_tooth, 2019-05-02
@saw_tooth

Have you already looked at QSyntaxHighlighter ?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question