Krita Source Code Documentation
Loading...
Searching...
No Matches
test.py
Go to the documentation of this file.
1"""
2SPDX-FileCopyrightText: 2017 Eliakin Costa <eliakim170@gmail.com>
3
4SPDX-License-Identifier: GPL-2.0-or-later
5"""
6# editor.py
7
8try:
9 from PyQt6.QtCore import QApplication
10 from PyQt6.QtGui import QFont
11 from PyQt6.QtWidgets import QPlainTextEdit
12except:
13 from PyQt5.QtCore import QApplication
14 from PyQt5.QtGui import QFont
15 from PyQt5.QtWidgets import QPlainTextEdit
16
17import syntax
18
19app = QApplication([])
20editor = QPlainTextEdit()
21f = QFont("monospace", 10, QFont.Weight.Normal)
22f.setFixedPitch(True)
23editor.document().setDefaultFont(f)
24highlight = syntax.PythonHighlighter(editor.document())
25
26
27editor.show()
28
29# Load syntax.py into the editor for demo purposes
30
31# infile = open('syntax.py', 'r')
32# editor.setPlainText(infile.read())
33
34app.exec()