problem
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.
Solution:
Call after the page is fully loaded.
sunburst_view.load(QUrl("file:///sunburst.html"))
sunburst_view.loadFinished.connect(set_sunburst_data) # 加上这一句
sunburst_layout.addWidget(sunburst_view)
def set_sunburst_data(self):
js = "setData({0})".format(self.data)
self.hero_count_view.page().runJavaScript(js)
solve the problem.
Similar Posts:
- Applet error: XXX is not defined (How to Solve)
- loaded some nib but the view outlet was not set
- The Usage of v-clock
- Elimination of warning message “nested weights are bad for performance”
- [troubleshooting] through the remote execution of the script by the scheduling system, the MySQL command not found exception is reported
- On the error of cannot read property ‘xxx’ of null in JS
- The differences between response. Getwriter(). Write() and response. Getwriter(). Print(), as well as pritwriter object and out object
- How to fix error messages related to sap ui5 aggregation with cardinality 0.. 1
- [Solved] Android Warning: android.content.res.Resources$NotFoundException: Resource ID #0x7f08010a
- Error in JS function referencing public page [How to Solve]