python 3.x - How to embed 'QScintilla' code editor in self-made PyQt GUI? -
i'm making small ide - fun! write in python, , use pyqt5 library build gui.
here screenshot of current status:
the code editor simple qtextedit()
widget - embedded in qframe()
widget, embedded in main window. parent child relationship follows (just bit simplified):
qmainwindow( ) >> qframe( ) >> qtextedit( )
i implemented basic syntax highlighting, using qsyntaxhighlighter()
class pyqt5. that's great - not yet awesome. mr. bakuriu advised me take @ qscintilla
package. struggle several questions:
question 1: installing qscintilla
this pyqt documentation can find qscintilla2: http://pyqt.sourceforge.net/docs/qscintilla2/ . apparently on windows need download source code of qscintilla2 , build dll
-file. isn't there more convenient way? example, pre-built packages (with installer)?
i found download page: http://www.scintilla.org/scintilladownload.html . download page mentions: <<there no download available containing scintilla dll. however, included in scite executable full download scilexer.dll.>>
. if interpret right, can prebuilt scintilla dll
-file in way. download page doesn't mention pyqt anywhere. i'm wondering if dll
-file work in pyqt. after all, download scintilla
, not qscintilla
.
and once dll
-file, how use embed qscintilla editor inside qframe?
question 2: scintilla or scite?
reading scintilla (and qscintilla) stumbled on scite. made nice installer software: http://www.ebswift.com/scite-text-editor-installer.html . advisable embed scite in pyqt gui? , if - wouldn't need 'qscite' instead of plain 'scite'?
question 3: example code
once (q)scintilla or (q)scite installed, need started somehow. if has embedded scintilla/scite in pyqt gui, please post example code. helpful :-)
edit
after several months came old question of mine. in meantime, have collaborated friend matic kukovec, resulted in nice tutorial on how use qscintilla:
qscintilla wonderful tool, information scarce. hope initiative can provide needed documentation.
q1:
you need install qscintilla , python bindings. don't know windows, seems available on pip.
q2:
scintilla editor widget. scite full app using editor widget, scriptable in lua language. qscintilla qt port of scintilla editor widget.
q3:
a qsciscintilla object subclass of qwidget, can run:
from pyqt5.qtwidgets import qapplication pyqt5.qsci import qsciscintilla app = qapplication([]) sci = qsciscintilla() sci.show() app.exec_()
Comments
Post a Comment