开发者

PyQT - How to implement Syntax Highlighting?

开发者 https://www.devze.com 2023-03-27 13:42 出处:网络
I want to write a little IDE for Cython using PyQT, but I don\'t have any idea how to implement Syntax Highlighting.

I want to write a little IDE for Cython using PyQT, but I don't have any idea how to implement Syntax Highlighting.

I know how to parse the Python-source, but I don't know how I can set the color for different words within the Textfield in PyQT.开发者_如何学Python

I could use HTML for this, but how does it work in realtime ? I mean when the user edits the text I need to be able to immediately change the text's format, etc.

Do you know how I can achieve this ?


Have you considered using QScintilla?

"As well as features found in standard text editing components, QScintilla includes features especially useful when editing and debugging source code. These include support for syntax styling, error indicators, code completion and call tips."


I would recommend checking out the code in KhtEditor which is written in Python using PyQt. I believe the author is also working on a port from QWidget to QML.

0

精彩评论

暂无评论...
验证码 换一张
取 消