Flickering of webengineview when showing webGL content AND having an secondary screen attached
-
wrote on 19 Apr 2024, 07:38 last edited by raphm01
I implement an application based on pyqt6 with a webengine view which shows a web page with webgl content. I noticed that a quite weird bug:
When I connect a secondary screen to the laptop, and only then, in an unpredictable fashion, the webengineview content starts and stops to flicker.OS: Windows 11
pyqt version: 6.6.1
pyqt6-webengine: 6.6.0Hardware:
- Lenovo Ideapad 330 with secondary screen attached (important!)
- CPU: Intel i5 8250U
- GPU: Intel UHD Graphics 620
Example code:
#!/usr/bin/env python # -*- coding: utf-8 -*- """ WebGL Windows Flickering example, stripped down from original application Hardware: * Lenovo Ideapad 330 with secondary screen attached (important!) * CPU: Intel i5 8250U * GPU: Intel UHD Graphics 620 """ import sys from PyQt6.QtCore import QUrl from PyQt6.QtWebEngineWidgets import QWebEngineView from PyQt6.QtWidgets import QApplication, QMainWindow, QWidget, QVBoxLayout class MainWindow(QMainWindow): def __init__(self): super().__init__() wgt_main = QWidget() self.layout_main = QVBoxLayout() wgt_main.setLayout(self.layout_main) self.setCentralWidget(wgt_main) self.wbv_main = QWebEngineView() self.wbv_main.load(QUrl("https://threejs.org/examples/#webgl_animation_keyframes")) self.wbv_main.show() self.layout_main.addWidget(self.wbv_main) self.showMaximized() if __name__ == "__main__": # Start QT app app = QApplication(sys.argv) window = MainWindow() window.show() app.exec()
If I open the same web page with Chrome, I do not get any flickering at all.
The bug does not show up on Ubuntu or if no secondary screen is attached.Can anybody make sense of this?
-
wrote on 14 May 2024, 12:08 last edited by
Anybody?
I know that the bug is quite specific, but it is a showstopper, still since the environment described is very common (windows laptop with external screen) -
wrote on 27 Aug 2024, 09:21 last edited by
self.showMaximized()Put it in front,
Because the initial window is small, flickering is when the window suddenly maximizes
from PyQt6.QtCore import QUrl
from PyQt6.QtWebEngineWidgets import QWebEngineView
from PyQt6.QtWidgets import QApplication, QMainWindow, QWidget, QVBoxLayoutclass MainWindow(QMainWindow):
def init(self):
super().init()
self.showMaximized()
wgt_main = QWidget()
self.layout_main = QVBoxLayout()
wgt_main.setLayout(self.layout_main)
self.setCentralWidget(wgt_main)self.wbv_main = QWebEngineView() self.wbv_main.load(QUrl("https://threejs.org/examples/#webgl_animation_keyframes")) self.wbv_main.show() self.layout_main.addWidget(self.wbv_main)
if name == "main":
# Start QT app
app = QApplication(sys.argv)window = MainWindow() window.show() app.exec()