Class: QgsCodeEditorPython

class qgis.gui.QgsCodeEditorPython(parent: QWidget = None, filenames: Iterable[str] = [])

Bases: QgsCodeEditor

Construct a new Python editor.

  • parent (QWidget = None) – The parent QWidget

  • filenames (Iterable[str] = []) – The list of apis files to load for the Python lexer

New in version 2.6.

A Python editor based on QScintilla2. Adds syntax highlighting and code autocompletion.


may not be available in Python bindings, depending on platform support

actionEvent(self, QActionEvent)
canInsertFromMimeData(self, QMimeData) → bool
changeEvent(self, QEvent)
childEvent(self, QChildEvent)
closeEvent(self, QCloseEvent)
connectNotify(self, QMetaMethod)
contextMenuEvent(self, QContextMenuEvent)
create(self, window: sip.voidptr = 0, initializeWindow: bool = True, destroyOldWindow: bool = True)
customEvent(self, QEvent)
destroy(self, destroyWindow: bool = True, destroySubWindows: bool = True)
disconnectNotify(self, QMetaMethod)
dragEnterEvent(self, QDragEnterEvent)
dragLeaveEvent(self, QDragLeaveEvent)
dragMoveEvent(self, QDragMoveEvent)
drawFrame(self, QPainter)
dropEvent(self, QDropEvent)
enterEvent(self, QEvent)
event(self, QEvent) → bool
eventFilter(self, QObject, QEvent) → bool
focusInEvent(self, QFocusEvent)
focusNextChild(self) → bool
focusNextPrevChild(self, bool) → bool
focusOutEvent(self, event: QFocusEvent)
focusPreviousChild(self) → bool
fromMimeData(self, QMimeData) → Tuple[QByteArray, bool]
getMonospaceFont(self) → QFont
hideEvent(self, QHideEvent)
initPainter(self, QPainter)
initStyleOption(self, QStyleOptionFrame)
inputMethodEvent(self, QInputMethodEvent)
inputMethodQuery(self, Qt.InputMethodQuery) → Any
isFixedPitch(self, font: QFont) → bool
isSignalConnected(self, QMetaMethod) → bool
keyPressEvent(self, event: QKeyEvent)
keyReleaseEvent(self, QKeyEvent)
leaveEvent(self, QEvent)
loadAPIs(self, filenames: Iterable[str])

Load APIs from one or more files


filenames (Iterable[str]) – The list of apis files to load for the Python lexer

loadScript(self, script: str) → bool

Load a script file


script (str) – The script file to load

Return type


metric(self, QPaintDevice.PaintDeviceMetric) → int
mouseDoubleClickEvent(self, QMouseEvent)
mouseMoveEvent(self, QMouseEvent)
mousePressEvent(self, QMouseEvent)
mouseReleaseEvent(self, QMouseEvent)
moveEvent(self, QMoveEvent)
nativeEvent(self, Union[QByteArray, bytes, bytearray], sip.voidptr) → Tuple[bool, int]
paintEvent(self, QPaintEvent)
receivers(self, PYQT_SIGNAL) → int
resizeEvent(self, QResizeEvent)
QgsCodeEditorPython.scrollContentsBy(self, int, int)
sender(self) → QObject
senderSignalIndex(self) → int
QgsCodeEditorPython.setViewportMargins(self, int, int, int, int)

setViewportMargins(self, QMargins)

sharedPainter(self) → QPainter
showEvent(self, QShowEvent)
tabletEvent(self, QTabletEvent)
timerEvent(self, QTimerEvent)
toMimeData(self, Union[QByteArray, bytes, bytearray], bool) → QMimeData
viewportEvent(self, QEvent) → bool
viewportMargins(self) → QMargins
viewportSizeHint(self) → QSize
wheelEvent(self, QWheelEvent)