Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 42 additions & 0 deletions examples/async_map_view_demo.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import tkinter
import tkintermapview
from async_tkinter_loop import async_mainloop

# create tkinter window
root_tk = tkinter.Tk()
root_tk.geometry(f"{1000}x{700}")
root_tk.title("map_view_simple_example.py")

# create map widget
map_widget = tkintermapview.AsyncTkinterMapView(root_tk, width=9000, height=600, corner_radius=10)
map_widget.pack(fill="both", expand=True)

# set other tile server (standard is OpenStreetMap)
map_widget.set_tile_server("https://mt0.google.com/vt/lyrs=m&hl=en&x={x}&y={y}&z={z}&s=Ga", max_zoom=22) # google normal
# map_widget.set_tile_server("https://mt0.google.com/vt/lyrs=s&hl=en&x={x}&y={y}&z={z}&s=Ga", max_zoom=22) # google satellite

# set current position and zoom
# map_widget.set_position(52.516268, 13.377695, marker=False) # Berlin, Germany
# map_widget.set_zoom(17)

# set current position with address
# map_widget.set_address("Berlin Germany", marker=False)

def marker_click(marker):
print(f"marker clicked - text: {marker.text} position: {marker.position}")

# set a position marker (also with a custom color and command on click)
marker_2 = map_widget.set_marker(52.516268, 13.377695, text="Brandenburger Tor", command=marker_click)
marker_3 = map_widget.set_marker(52.55, 13.4, text="52.55, 13.4")
# marker_3.set_position(...)
# marker_3.set_text(...)
# marker_3.delete()

# set a path
path_1 = map_widget.set_path([marker_2.position, marker_3.position, (52.568, 13.4), (52.569, 13.35)])
# path_1.add_position(...)
# path_1.remove_position(...)
# path_1.delete()

# root_tk.mainloop()
async_mainloop(root_tk)
4 changes: 3 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,6 @@ pillow~=9.3.0
future~=0.18.2
geocoder
pywin32; platform_system=="Windows"
pyperclip~=1.8.2
pyperclip~=1.8.2
aiohttp>=3.11.11
async-tkinter-loop>=0.9.3
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,5 @@
classifiers=["Operating System :: OS Independent",
"Programming Language :: Python :: 3",
"License :: CC0 1.0 Universal (CC0 1.0) Public Domain Dedication"],
install_requires=["geocoder", "pillow", "requests", "pyperclip", 'pywin32; platform_system=="Windows"', "customtkinter"],
install_requires=["geocoder", "pillow", "requests", "pyperclip", 'pywin32; platform_system=="Windows"', "customtkinter", "aiohttp", "async-tkinter-loop"],
python_requires=">=3.6")
1 change: 1 addition & 0 deletions tkintermapview/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
__version__ = "1.29"

from .map_widget import TkinterMapView
from .async_map_widget import AsyncTkinterMapView
from .offline_loading import OfflineLoader
from .utility_functions import convert_coordinates_to_address, convert_coordinates_to_country, convert_coordinates_to_city
from .utility_functions import convert_address_to_coordinates
Expand Down
Loading