Skip to content

wbsoft/parceqt

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

parceqt

Small Python library to use parce with Qt's QTextDocument.

This module depends on parce (https://parce.info/) and PyQt(https://riverbankcomputing.com/software/pyqt)

Example:

from PyQt5.QtWidgets import QApplication, QTextEdit
from PyQt5.QtGui import QTextDocument

app = QApplication([])
doc = QTextDocument()
e = QTextEdit()
e.setDocument(doc)
e.resize(600, 400)
e.show()

import parceqt
from parce.lang.xml import Xml

parceqt.set_root_lexicon(doc, Xml.root)
parceqt.highlight(doc)
parceqt.adjust_widget(e)    # adjust widgets font and base colors

Now the text in the document is automatically highlighted using the specified root lexicon; the highlighting is updated as the user modifies the text.

About

Small Python library to use the Python parce module with Qt's QTextDocument

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages