简体   繁体   中英

do you know of any python component(s) for syntax highlighting?

Are there any easy to use python components that could be used in a GUI? It would be great to have something like JSyntaxPane for Python. I would like to know of python-only versions ( not interested in jython ).

Other than pygments? http://pygments.org/

If you're using gtk+, there's a binding of gtksourceview for Python in gnome-python-extras . It seems to work well in my experience. The downside: the documentation is less than perfect.

There's also a binding of QScintilla for Python if PyQt is your thing.

You can use StyledTextCtrl in wxPython . Check out the official demo for an example (The demo code tab for any demo).

You say "in a GUI app" but don't mention the toolkit.

If you are using PyQt, and need a read-only widget, you can use QWebKit which has a whole HTML widget in it based on WebKit, so it supports pretty much anything, from flash to the ACID2 test.

If you want a read-write widget, Qt's QTextEdit supports syntax highlighting, and I wrote an adapter to let pygments worj with it:

http://lateral.netmanagers.com.ar/weblog/2009/09/21.html#BB831

I am sure something similar can be done with other toolkits, but I don't know how.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM