A little error but the code still not works :
           if self.editor.text()[1] == '#':
must be changed to
           if self.editor.text()[0] == '#':


projetmbc a écrit :
After the long struggle of the newbie, I read part of code of Eric so I can start something.

I don't understand what's wrong in the following lines (a line begining by # must be red in the editor but it's blue) :
=================================
class myLexer(Qsci.QsciLexerCustom):
   def description(self, style):
       if style == 0:
           return 'ID_DEFAULT'
       if style == 1:
           return 'ID_COMMENT'
       return ''

   def defaultColor(self, style):
       if style==ID_DEFAULT:
           return QtGui.QColor(0,0,255)
       if style==ID_COMMENT:
           return QtGui.QColor(255,0,0)
       return QtGui.QColor(0,0,0)

   def styleText(self, start, end):
# Taken from the source code of Eric.
       self.editor.startStyling(start, 0x3f)
       if self.editor.text()[1] == '#':
           self.editor.setStyling(5, ID_COMMENT)
           self.editor.startStyling(start+5, 0x3f)
       else:
           self.editor.setStyling(5, ID_DEFAULT)
=================================

I hope that someone can help me.

Best regards.
Christophe
------------------------------------------------------------------------

_______________________________________________
PyQt mailing list    [email protected]
http://www.riverbankcomputing.com/mailman/listinfo/pyqt


_______________________________________________
PyQt mailing list    [email protected]
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

Reply via email to