
TkinterMapView is a map widget for tkinter and CustomTkinter. It shows an interactive map, which you can move with the mouse and zoom with the mouse wheel, like a map in the browser. By default the map comes from OpenStreetMap, but you can use any other tile server, for example Google Maps or Google satellite images. A second tile server can draw an overlay on top of the map, like the sea marks of OpenSeaMap.
On the map you can place markers with a text, an image or your own icon, draw paths and polygons, and react to clicks on the map and on the markers. Addresses can be converted to coordinates and back, so the map can also be moved to a place by its name. If your app has to work without an internet connection, the tiles of an area can be downloaded into a database first and are then loaded from there.
The map is a normal tkinter widget and is placed with grid, pack or place like all other widgets. So it fits into a CustomTkinter app with buttons, entries and frames around it. The window below is map_with_customtkinter.py from the examples of TkinterMapView:
Installation
TkinterMapView is installed with pip:
pip install tkintermapview
The tutorials need version 1.32 or newer. If you already have an older version, update it with pip install --upgrade tkintermapview. More examples and a short description of all methods are in the readme on GitHub.
Tutorials
The tutorials start with a simple map in a CTk window and add a bit more in every part: markers with your own icons, click events and a right click menu, and at the end other tile servers and overlays.
1. Your First Map
Show an OpenStreetMap map in a CustomTkinter or tkinter app with TkinterMapView, set the position and zoom, search for addresses and coordinates.
2. Markers
Add markers to a TkinterMapView map, react to clicks on markers, attach your own data, use custom icons and images, and move, change or delete markers.
3. Click Events
React to left and right clicks on a TkinterMapView map, add markers where the user clicks, tell marker clicks from map clicks and get the address of a point.
4. Tile Servers
Change the tile server of TkinterMapView, follow the OpenStreetMap tile usage policy, show the attribution, add overlays and fix 403 errors and empty tiles.