Question

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 ) .

Was it helpful?

Solution

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.

OTHER TIPS

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

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top