import os import sys from PyQt5.QtWidgets import QApplication, QWidget, QLabel, QVBoxLayout, QMenu from PyQt5.QtGui import QPixmap from PyQt5.QtCore import Qt, QTimer import psutil class Label(QLabel): def __init__(self, parent=None): super().__init__(parent) self.parent_object = None def mouseDoubleClickEvent(self, event): if self.parent_object is None: return if event.button() == Qt.MiddleButton: self.parent_object.menu.popup(event.globalPos()) class MainClass(): def __init__(self): if not QApplication.instance(): self.app = QApplication(sys.argv) else: self.app = QApplication.instance() self.window = QWidget() self.window.setWindowFlags( Qt.FramelessWindowHint | Qt.WindowStaysOnTopHint | Qt.Tool ) self.window.setAttribute(Qt.WA_TranslucentBackground) self.window.setStyleSheet("background-color: rgba(0, 0, 0, 0);") self._create_gui() self.debug_timer = QTimer() self.debug_timer.timeout.connect(self.log_stats) self.debug_timer.start(500) self.window.show() #SYSTEM MONITORING self.process = psutil.Process(os.getpid()) sys.exit(self.app.exec_()) def log_stats(self): count = len(self.window.children()) mem_mb = self.process.memory_info().rss / (1024 * 1024) print(f"RAM: {mem_mb:.2f} MB | Qt Objects: {count}") def get_placeholder(self, width=357, height=342, color="blue"): pixmap = QPixmap(width, height) pixmap.fill(Qt.GlobalColor.blue if color == "blue" else Qt.GlobalColor.red) return pixmap def _create_gui(self): layout = QVBoxLayout(self.window) layout.setContentsMargins(0, 0, 0, 0) layout.setSpacing(0) self.label = Label(self.window) self.label.parent_object = self self.label.setPixmap(self.get_placeholder()) layout.addWidget(self.label) self.menu = QMenu(self.window) self.Movie_menu = QMenu("menu1", self.window) self.Movie_menu.addAction('option1', self.option1) self.Movie_menu.addAction('option2', self.option2) self.Movie_menu.addAction('option3', self.option3) self.menu.addMenu(self.Movie_menu) menu_stylesheet = """ QMenu { background-color: #2a2a2a; color: #ffffff; border: 1px solid #444444; padding: 2px; } QMenu::item:selected { background-color: #0078d4; color: #ffffff; } QMenu::separator { background-color: #444444; height: 1px; margin: 2px 0px; } """ self.menu.setStyleSheet(menu_stylesheet) self.window.setWindowTitle("Leakymenu") self.window.setFixedSize(357, 342) def option1(self): pass def option2(self): pass def option3(self): pass if __name__ == "__main__": main = MainClass()