Pyqt5: How to solve the uncaught referenceerror when Python uses qwebengineview


In the previous example in which Python used ecarts to draw charts in pyqt5, the radar was successfully loaded using qwebengineview, but an error was reported when the rising sun Sunburst was loaded later:

js:Uncaught ReferenceError: setData is not defined

After querying the data, we know that the custom SetData method cannot be found because the web page is not fully loaded.


Call after the page is fully loaded.

sunburst_view.loadFinished.connect(set_sunburst_data)  # 加上这一句

def set_sunburst_data(self):
    js = "setData({0})".format(

solve the problem.

Similar Posts: