Home
Softono
QCodeEditor

QCodeEditor

Open source MIT Python
32
Stars
5
Forks
2
Issues
2
Watchers
9 years
Last Commit

About QCodeEditor

Light QPlainTextEdit based widget which provides the line numbers bar and the syntax and the current line highlight (PyQt)

Platforms

Web Self-hosted

Languages

Python

Links

QCodeEditor widget (PyQt)


Overview

QCodeEditor is a light code editor widget based on QPlainTextEdit and provides the following features:

  • line numbers bar - set by DISPLAY_LINE_NUMBERS flag equals True

  • curent line highligthing - set by HIGHLIGHT_CURRENT_LINE flag equals True

  • syntax highlighting - setting up a QSyntaxHighlighter. As an example XML syntax highlighter was used.

Widget is compatible with Python 2.7 or Python 3.3+ and PyQt4 4.6+ or PyQt5 5.2+.


.. figure:: ./demo.gif :align: center :figwidth: 100 %


API

.. code-block:: python

class QCodeEditor(QPlainTextEdit):

    def __init__(self, DISPLAY_LINE_NUMBERS=True, HIGHLIGHT_CURRENT_LINE=True,
                 SyntaxHighlighter=None, *args):        
        '''
        Parameters
        ----------
        DISPLAY_LINE_NUMBERS : bool 
            defines the presence of the lines number bar
        HIGHLIGHT_CURRENT_LINE : bool
            switch on/off the current line highliting
        SyntaxHighlighter : QSyntaxHighlighter
            should be inherited from QSyntaxHighlighter            
        '''                          

References: