PyWebkitGtk and Google Maps...

11 views
Skip to first unread message

robconnolly

unread,
Jun 13, 2011, 9:27:49 PM6/13/11
to pywebkitgtk-devel
Hi All,

I'm writing a Gtk desktop application which embeds a Javascript
application via PyWebkitGtk. The Python code renders the HTML via
Jinja2 and then loads it into a WebView:

ctx = {"latitude": -36.8941129, "longitude": 174.9261563, "data": []}
# data will be a long list of coordinates
html = self.template.render(ctx)
self.browser.load_string(html, "text/html", "UTF-8", "file://" +
BASE_DIR)

On the JS side I'm using Google Maps to display the list of data as a
path on the map. So far I have the basic Google Maps tutorial code
[0]:

function init()
{
var latlng = new google.maps.LatLng({{ latitude }},
{{ longitude }});
// these are rendered via Jinja2
var myOptions = {
zoom: 14,
panControl: false,
zoomControl: false,
scaleControl: true,
center: latlng,
mapTypeId: google.maps.MapTypeId.ROADMAP
};
var map = new
google.maps.Map(document.getElementById("map_canvas"), myOptions);
}

I'm experiencing a weird problem where the map will not be rendered
when the container div is above a certain size (approx 660x580px),
instead I just get a blank cream-coloured box.

This appears to be a problem with PyWebkitGtk as the same page renders
just fine in Firefox.

Has anyone else experienced anything similar?

Thanks in advance,

Cheers,

Rob

[0] http://code.google.com/apis/maps/documentation/javascript/tutorial.html
Reply all
Reply to author
Forward
0 new messages