[PyQt] QsciScintilla Lexer disappears?

Vincent Vande Vyvre vincent.vandevyvre at swing.be
Mon Apr 22 09:05:54 BST 2013


Le 22/04/2013 09:52, Vincent Vande Vyvre a écrit :
> Le 22/04/2013 02:51, Lee Harr a écrit :
>> I am trying to use QsciScintilla in a project but I am having some 
>> trouble
>> with the Lexer. I don't understand why this code shows the lexer at
>> the end of __init__ but when clicking in the margin it shows None.
>>
>> Any thoughts?
>>
>>
>>
>> import sys
>> from PyQt4.QtCore import SIGNAL
>> from PyQt4.QtGui import QApplication
>> from PyQt4.Qsci import QsciScintilla, QsciLexerPython
>>
>>
>> class SimplePythonEditor(QsciScintilla):
>>      def __init__(self, parent=None):
>>          super(SimplePythonEditor, self).__init__(parent)
>>
>>          self.setMarginSensitivity(1, True)
>>          self.connect(self,
>>              SIGNAL('marginClicked(int, int, Qt::KeyboardModifiers)'),
>>              self.on_margin_clicked)
>>
>>          lexer = QsciLexerPython()
>>          self.setLexer(lexer)
>>          print self.lexer()
>>
>>      def on_margin_clicked(self, nmargin, nline, modifiers):
>>          print self.lexer()
>>
>>
>> if __name__ == "__main__":
>>      app = QApplication(sys.argv)
>>      editor = SimplePythonEditor()
>>      editor.show()
>>      app.exec_()
>> _______________________________________________
>> PyQt mailing list    PyQt at riverbankcomputing.com
>> http://www.riverbankcomputing.com/mailman/listinfo/pyqt
> Remove the parenthesis of 'print self.lexer'
>
Oops, I'm wrong, it's not the same object ....

-- 
Vincent V.V.
Oqapy <https://launchpad.net/oqapy> . Qarte 
<https://launchpad.net/qarte> . PaQager <https://launchpad.net/paqager>


More information about the PyQt mailing list