1
votes

I want to show a plotly figure in a vertical layout with QWebView.

If i copy the html code and open in a browser this works, but not in a QWebView. Why ???

raw_html = '<html><head><meta charset="utf-8" />'
raw_html += '<script src="https://cdn.plot.ly/plotly-latest.min.js"></script></head>'
raw_html += '<body>'
raw_html += po.plot(fig, include_plotlyjs=False, output_type='div')
raw_html += '</body></html>'                      


fig_view = QWebView()  
fig_view.setHtml(raw_html)  
self.dialog_graphViewer.verticalLayout.addWidget(fig_view)

fig_view.show()
fig_view.raise_()

This code only shows a white screen .

I have tested your code obviously by patching it and it works correctly so I presume that there is another part of your code that is generating the error, so it is necessary that 1) provide a minimal reproducible example, 2) indicate your OS and PyQt5 versioneyllanesc