Closed ghost closed 2 years ago
Hi, i have this code:
# Click on mpv window toggles overlay visibility import sys import os import signal import locale import mpv # Everything is working good if PyQt5 set here # but broken if PyQt6 (show only first time and ignoring click events then) from PyQt6 import QtWidgets, QtCore class Test(QtWidgets.QMainWindow): def __init__(self, parent=None): super().__init__(parent) self.container = QtWidgets.QWidget(self) self.setCentralWidget(self.container) self.container.setAttribute(QtCore.Qt.WidgetAttribute.WA_DontCreateNativeAncestors) self.container.setAttribute(QtCore.Qt.WidgetAttribute.WA_NativeWindow) player = mpv.MPV(wid=str(int(self.container.winId())), vo='x11') @player.on_key_press('MBTN_LEFT') def left_btn_handler(): if overlay.isVisible(): # <===== overlay.hide() else: overlay.show() player.mute = True player.play('https://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4') app = QtWidgets.QApplication(sys.argv) app.aboutToQuit.connect(lambda: os.kill(os.getpid(), signal.SIGTERM)) locale.setlocale(locale.LC_NUMERIC, 'C') win = Test() win.resize(960, 540) overlay = QtWidgets.QLabel("Hello World!", win) # <===== overlay.resize(100, 50) overlay.setAlignment(QtCore.Qt.AlignmentFlag.AlignCenter) overlay.setStyleSheet('color: red') overlay.hide() win.show() try: sys.exit(app.exec_()) except: sys.exit(app.exec())
it's working good in PyQt5 but broken in PyQt6 (try clicking multiple times on mpv window). Is this python-mpv issue?
Hi, i have this code:
it's working good in PyQt5 but broken in PyQt6 (try clicking multiple times on mpv window).
Is this python-mpv issue?