Skip to content

Instantly share code, notes, and snippets.

@ssokolow
ssokolow / term_qt.py
Created April 26, 2020 09:04
Example of creating a simple terminal emulator widget from a QTextEdit
"""Primitive terminal emulator example made from a PyQt QTextEdit widget."""
import fcntl, locale, os, pty, struct, sys, termios
import subprocess # nosec
# Quick hack to limit the scope of the PyLint warning disabler
try:
# pylint: disable=no-name-in-module
from PyQt5.QtCore import Qt, QSocketNotifier # type: ignore
from PyQt5.QtGui import QFont, QPalette, QTextCursor # type: ignore
import wx
import wx.stc as stc
class XmlSTC(stc.StyledTextCtrl):
def __init__(self, parent):
stc.StyledTextCtrl.__init__(self, parent)
self.SetLexer(stc.STC_LEX_XML)