[PyQt] Question about QsciLexerCustom

Phil Thompson phil at riverbankcomputing.com
Wed Jun 10 14:31:15 BST 2009

On Wed, 10 Jun 2009 15:12:03 +0200, projetmbc <projetmbc at club-internet.fr>
> Hello,
> I would like to use QsciLexerCustom so as to define my own lexer. The 
> documentation says :
>              "All that is necessary to implement a new lexer is to 
> define appropriate
>               styles and to re-implement the styleText() 
> <classQsciLexerCustom.html#91d71c4bdff5140ae0b0cb34b4511f79> method."
> This sounds very abstract to me. How can I color a single word like 
> STRANGE ? How can I define a block like a C++ comment ?

You have to parse the text you are being asked to style (or find it in a
data structure you have already created) to determine what style should be
applied to each character (or group of characters). Apply the style by
making a call to startStyling() followed by one or more calls to


More information about the PyQt mailing list