1

My PyQtWebEngineView is randomly flickering black(i think it has to do with context menus and tooltips)

Try it yourseft:

import sys
from PyQt5 import QtCore, QtGui, QtWidgets
from PyQt5.QtWebEngineWidgets import QWebEngineView, QWebEngineSettings


class UiBrowser(QtWidgets.QWidget):
    def __init__(self):
        super().__init__()
        self.browser = QWebEngineView(self)
        self.browser.setUrl(QtCore.QUrl("https://www.google.com"))
        self.browser.settings().setAttribute(QWebEngineSettings.FullScreenSupportEnabled, True)

        self.initUI()

    def initUI(self):
        layout = QtWidgets.QVBoxLayout(self)
        layout.addWidget(self.browser)

    def keyPressEvent(self, event):
        if event.key() == QtCore.Qt.Key_F11:
            self.toggleFullScreen()

    def toggleFullScreen(self):
        if self.isFullScreen():
            self.showNormal()
        else:
            self.showFullScreen()


if __name__ == "__main__":
    app = QtWidgets.QApplication(sys.argv)
    window = QtWidgets.QMainWindow()
    window.setWindowTitle("Minimal Web Browser")
    browser_widget = UiBrowser()
    window.setCentralWidget(browser_widget)
    window.showFullScreen()
    sys.exit(app.exec_())

heres a video from the original code:

https://youtu.be/OrSx2awx4Lg(i had to record it with my phone because OBS wasn't working) If you run the given code you will see the same results.

  • I cannot reproduce this using Qt-5.15.10 on arch-linux. This issue is therefore specific to the platform/hardware you are testing on and/or the version of Qt5 you are using. – ekhumoro Aug 05 '23 at 21:31
  • It's also not reproducible on my Ubuntu 20.04 with PyQt 5.15.9. – relent95 Aug 07 '23 at 01:57
  • It's probably your network is bad or hardware is poor. – jett chen Aug 07 '23 at 03:55
  • @jettchen the network isn't a problem, hardware is also not slow. I think its just a driver problem with my graphics card or something – Etscharntmin Aug 07 '23 at 10:56

0 Answers0