添加PyQt5 QWebEngineView小部件会导致QWindowsEGLStaticContext错误

时间:2016-10-26 20:37:35

标签: python-3.x user-interface pyqt5

2台Windows机器中的1台发生以下错误,但我无法找到PC之间的差异。

我可以创建一个QWebEngineView小部件,但只要应用程序尝试显示小部件,我就会收到以下错误消息:

QMainWindowLayout::addItem::createWindowSurface: Could not create the EGL window surface: 0x300e
QOpenGLWidget: Failed to make context current
QMainWindowLayout::addItem::createWindowSurface: Could not create the EGL window surface: 0x300e
QOpenGLWidget: Failed to make context current
QMainWindowLayout::addItem::createWindowSurface: Could not create the EGL window surface: 0x300e
QOpenGLWidget: Failed to make context current
composeAndFlush: makeCurrent() failed
composeAndFlush: makeCurrent() failed
composeAndFlush: makeCurrent() failed
composeAndFlush: makeCurrent() failed

以下示例在一台计算机上创建错误消息,但在另一台计算机上正常工作。这有什么区别?机器之间是否存在一些OpenGL驱动程序的区别?幕后发生了什么?

import sys
import PyQt5.QtWidgets as QtWidgets
from PyQt5.QtWebEngineWidgets import QWebEngineView

class Main(QtWidgets.QMainWindow):
    def __init__(self):
        super(Main, self).__init__()

        self.engine = QWebEngineView()
        self.engine.setHtml('hello world')
        self.setCentralWidget(self.engine)
        self.show()

if __name__ == '__main__':
    app = QtWidgets.QApplication(sys.argv)
    main = Main()
    sys.exit(app.exec_())

如果我注释掉setCentralWidget行,则应用程序打开时没有错误。创建QWebEngineView不是问题,但是窗口小部件的显示会导致错误。

0 个答案:

没有答案