wxPython: How to combine StyledTextCtrl with pygments
Pygments is nice. It colorizes your code, has support for 1001 languages, and you can add your own highlighting scheme with just a few regular expressions. By default, it generates some HTML/CSS however, which is unusable within any editor component in your program. Here’s how to combine it with a StyledTextCtrl wxPython widget – the trick is to write a simle Formatter for pygments that wraps pygments’ default styles (or the ones you defined in your lexer) to some styles you have defined in your StyledTextCtrl. (code after the break)
(more…)








