How to call javascript function from PyQT

前端 未结 2 1152
臣服心动
臣服心动 2021-01-02 16:22

I\'m trying to interact with a google map using python. I\'ve built an application in PyQT with a QWebView. The QWebView loads a local html page as shown here:

<         


        
相关标签:
2条回答
  • 2021-01-02 17:01

    The error was that I needed to wait for the page to load. I added a button that was connected to the evaluateJavaScript("addMarker(-33.89,151.275)") call. When I clicked the button (after the page loaded), the marker was added as expected.

    0 讨论(0)
  • 2021-01-02 17:21

    http://pysnippet.blogspot.com/2010/01/more-fun-with-qwebkit.html might help.

    The only difference I can see between the two things you tried is that alert() is part of the standard functions. Maybe you need a document.addmarker() instead of just addmarker() ?

    0 讨论(0)
提交回复
热议问题