leon-thomm / Ryven

Flow-based visual scripting for Python
https://ryven.org
MIT License
3.8k stars 443 forks source link

PyQtWebEngine Node error #82

Closed kndidox closed 2 years ago

kndidox commented 2 years ago

I tried creating a PyQtWebEngine widget to display html in a node. I did it with the following code:

`class HTMLDisplay_MainWidget(MWB, QWebEngineView): def init(self, params): MWB.init(self, params) QWebEngineView.init(self)

self.setLayout(QVBoxLayout())

    #self.html_view = QWebEngineView()
    #self.layout().addWidget(self.html_view)
    raw_html = "<html><head></head><body style=""><div style=""><h1>This is an html</h1></div></body></html>"
    self.setHtml(raw_html)`

I get the following error

"Qt WebEngine seems to be initialized from a plugin. Please set Qt::AA_ShareOpenGLContexts using QCoreApplication::setAttribute before constructing QGuiApplication. Attribute Qt::AA_ShareOpenGLContexts must be set before QCoreApplication is created. WebEngineContext used before QtWebEngine::initialize() or OpenGL context creation failed. LaunchProcess: failed to execvp: /usr/local/lib/python3.8/dist-packages/PySide2-5.15.2-py3.8-linux-x86_64.egg/PySide2/Qt/libexec/QtWebEngineProcess LaunchProcess: failed to execvp: /usr/local/lib/python3.8/dist-packages/PySide2-5.15.2-py3.8-linux-x86_64.egg/PySide2/Qt/libexec/QtWebEngineProcess Trace/breakpoint trap (core dumped) "

please advice.

Screenshot from 2021-11-08 17-12-33

leon-thomm commented 2 years ago

I don't think the error is part of the code you show. Please provide a minimal example (code) that can be used to reproduce the issue. OS? versions? how did you install PySide2? thanks!

kndidox commented 2 years ago

Hello Leon, thanks for your answer.

In this pastebin codes you can see 2 simple methods where im trying to create this feature.

Widget: https://pastebin.com/L8Cr0x9P

Node: https://pastebin.com/2AKsNKaS

Im running this code in Ubuntu 20.04.03 Python 3.8.10 PySide2 5.15.2 QtPy 1.9.0

Thanks again for your help.

leon-thomm commented 2 years ago

I get similar errors

Qt WebEngine seems to be initialized from a plugin. Please set Qt::AA_ShareOpenGLContexts using QCoreApplication::setAttribute before constructing QGuiApplication.
WebEngineContext used before QtWebEngine::initialize() or OpenGL context creation failed.

Did you follow the error instructions? In any case this is very likely PySide2 related, and not Ryven.