Skip to content

Instantly share code, notes, and snippets.

View BerdyAlexei's full-sized avatar

Berdy Alexei BerdyAlexei

View GitHub Profile
@Patitotective
Patitotective / custom_context_menu.py
Last active June 26, 2024 10:27
Minimal example of how to use a custom context menu and add actions to it.
import sys
from PyQt5.QtWidgets import QApplication, QMainWindow, QTextEdit, QMenu, QAction
from PyQt5.QtGui import QCursor
from PyQt5.QtCore import Qt
class MainWindow(QMainWindow):
def __init__(self):
super().__init__()
self.text_edit = QTextEdit()