Python显示浏览器的一部分?

时间:2016-04-19 08:11:01

标签: python

我正在构建一个"应用程序"并需要显示谷歌地图以显示某些位置的标记。我以为我可能会创建一个带有谷歌地图的网页。然后在python GUI(由某些api)中显示它。

有没有任何gui api可以支持这个?

1 个答案:

答案 0 :(得分:0)

请查看http://www.gnu.org/software/pythonwebkit/ 您需要将<iframe>添加到dom文档树

def _view_load_finished_cb(self, view, frame):
    doc = frame.get_dom_document()
    nodes = doc.getElementsByTagName('body')
    body = nodes.item(0)

    d = doc.createElement("iframe")
    d.setAttribute('width', 640)
    d.setAttribute('height', 480)
    d.setAttribute('src', 'https://www.google.com/maps/embed/v1/place?key=YOUR_API_KEY&q=Space+Needle,Seattle+WA')
    body.appendChild(d)