Skip to content Skip to sidebar Skip to footer

Display Google Map Api In Python Tkinter Window

Hi I am working on Google Map API in Python. I am using the source code which can be found at this website This code when compiled produces a 'htm' file showing a Google Map with

Solution 1:

The htm image pymaps produces isn't an image, it's an html file. Basically a little webpage. To display it, you would have to render the html. The only html renderer for TkInter that I know of is TkHTML, although I've never used it, so it might not support all the javascript that you html file uses.

You would be much better off dropping TkInter entirely and switching to a more modern widget toolkit such as wxPython which has html rendering built in. You can see the documentation for html in wxPython here. If you have GTK on your system, I've used pywebkitgtk successfully.

However, do you need to render this frame for something specific? If you just want to open the file from python, you can use the webbrowser built in library to open it with your default browser.

import webbrowser

webbrowser.open('test.htm')

And that's it.

Post a Comment for "Display Google Map Api In Python Tkinter Window"