RkBlog

Hardware, programming and astronomy tutorials and reviews.

QScintilla2 and PyQT4

Adding widgets for programmers to PyQt4.

QScintilla is a QT library that adds few widgets - text editor widgets with code highlighting, code autocompletion etc. For PyQT4 we can use a Qscintilla2 snapshot. Download and untar the sources, then go to Qt4 folder in a terminal en execute (linux/unix, as root or sudo):
qmake qscintilla.pro
make
make install
Then go to Python folder and execute:
python configure.py
make
make install
Then go to designer-Qt4 and execute:
qmake designer.pro
make
make install
And we are done. Qscintilla2 should now be available, use this code to test:
import PyQt4.Qsci
langs = [i for i in dir(PyQt4.Qsci) if i.startswith('QsciLexer')]

for i,l in enumerate(langs):
    print i,l[9:]
The result should be like this:
0
1 Bash
2 Batch
3 CMake
4 CPP
5 CSS
6 CSharp
7 D
8 Diff
9 HTML
10 IDL
11 Java
12 JavaScript
13 Lua
14 Makefile
15 POV
16 Perl
17 Properties
18 Python
19 Ruby
20 SQL
21 TeX
22 VHDL
More on PyQt4 snippets.
RkBlog

14 July 2008;

Comment article