So i'm using the Google Maps API to work out the straight-line distance between 2 points on the map.
Qt Code:
  1. gmaps="""
  2. ***generic google maps HTML api stuff first, then:***
  3.  
  4. overalldist=calcDistance(firstcoord, secondcoord);
  5. alert(overalldist)
  6.  
  7. //calculates distance between two points in km's
  8. function calcDistance(firstcoord, secondcoord) {
  9. return (google.maps.geometry.spherical.computeDistanceBetween(firstcoord, secondcoord) / 1000).toFixed(2);
  10. """
To copy to clipboard, switch view to plain text mode 

This is within the script section of my HTML code which is all placed within a simple string in Python. The string is called by:
Qt Code:
  1. self.webView.setHtml(gmaps)
To copy to clipboard, switch view to plain text mode 
Where gmaps is the string name that contains the HTML and webView is the name of the HTML viewer in my PyQt GUI.

The outcome is a popup box outputting the correct distance.

My issue is that I cannot extract the variable 'overalldist' from the HTML. The alert pops up with the correct distance but I then cannot move this into my Python code.

Please advise.

Any further ideas?

It is the function calcDistance I am attempting to retrieve from the HTML code to use in my Python code.