I have a simple Python file which uses the QtWebkit.QWebView to display a google maps page.
This is done by calling the HTML which includes some java script.
What I don't know how to do is get the co-ordinates from Python to the java script in the HTML file.
Perhaps someone can point me in the right direction?
PYTHON:
class MainWin(QDialog,MainFrm.Ui_MainWin):
def __init__(self, parent=None):
super(MainWin,self).__init__(parent)
self.setupUi(self)
self.lat = -25.723146
self.long = 28.267628
self.GMapWidget.load("markers.html?",coords = self.lat)
app = QApplication(sys.argv)
frm=MainWin()
frm.show()
app.exec_()
HTML:
<!DOCTYPE html>
<html>
<head>
<style type="text/css">
html, body, #map-canvas { height: 100%; margin: 0; padding: 0;}
</style>
<script type="text/javascript"
src="https://maps.googleapis.com/maps/api/js?key=AIzaSyCrRTR8nZX3m6g_nYbilamyKSBHx9QUdfw">
</script>
<!DOCTYPE html>
<html>
<head>
<style type="text/css">
html, body, #map-canvas { height: 100%; margin: 0; padding: 0;}
</style>
<script type="text/javascript"
src="https://maps.googleapis.com/maps/api/js?key=AIzaSyCrRTR8nZX3m6g_nYbilamyKSBHx9QUdfw">
</script>
<script type="text/javascript">
lt = -25.723146
ln = 28.267628
function initialize() {
var mapOptions = {
center: { lat: lt, lng: ln},
zoom: 8
};
var map = new google.maps.Map(document.getElementById('map-canvas'),
mapOptions);
}
google.maps.event.addDomListener(window, 'load', initialize);
</script>
</head>
<body>
<div id="map-canvas"></div>
</body>
</html>
</head>
<body>
<div id="map-canvas"></div>
</body>
</html>