ANN: PyQt v4.1 Released

David Boddie david at boddie.org.uk
Thu Nov 9 11:06:52 EST 2006


Tool69 wrote:

> > That uses a port of an old syntax highlighting example from Qt 4.0. Someone
> needs to "port" the C++ example from Qt 4.2 to PyQt4.
>
> So, we've got no sample to use QScintilla2 ??

Well, this should get you started:

import sys
from PyQt4.QtGui import QApplication
from PyQt4.Qsci import QsciScintilla, QsciLexerPython

if __name__ == "__main__":
    app = QApplication(sys.argv)
    editor = QsciScintilla()
    lexer = QsciLexerPython()
    editor.setLexer(lexer)
    editor.show()
    editor.setText(open("qscintilla2_example.py").read())
    sys.exit(app.exec_())

QScintilla provides a selection of different lexers, so you might want
to experiment with those.

Good luck!

David




More information about the Python-list mailing list