Hi. I am developing an application using tkintermapview wherein I am reading a network file in real time and trying to plot the Latitude & Longitude values on the map in real time. I am using the following code:
import tkinter as tk
import tkintermapview
import threading
import hashlib
window = tk.Tk()
map_widget = tkintermapview.TkinterMapView(window, width=1000, height=700, corner_radius=10)
map_widget.set_tile_server("https://mt0.google.com/vt/lyrs=m&hl=en&x={x}&y={y}&z={z}&s=Ga", max_zoom=30)
map_widget.pack(fill="both", expand=True)
icon_1 = tk.PhotoImage(file=r'C:\Users\Desktop\Data\icon.png')
icon_1 = icon_1.subsample(12, 12)
net_file = r'Z:\filename.txt' ## Path to network file
def plot_points(net_file):
with open(net_file) as f:
chksum_1 = hashlib.md5(f.read()).hexdigest()
while True:
with open(net_file) as f:
chksum_2 = hashlib.md5(f.read()).hexdigest()
if chksum_1 == chksum_2:
pass
else:
chksum_1 = chksum_2
## get the latitude and longitude values of the object for plotting on map
map_widget.set_marker(lat, lon, text="Posn. Info.", text_color='#FF0000', icon=icon_1)
threading.Thread(target = plot_points, daemon = True, args = (net_file,)).start()
window.mainloop()
Issue that I am facing is after running the above code the application becomes very slow and even if I trying to move the map using mouse it not responding immediately. Can someone tell me what can be the issue and how to resolve it.
Hi. I am developing an application using tkintermapview wherein I am reading a network file in real time and trying to plot the Latitude & Longitude values on the map in real time. I am using the following code:
Issue that I am facing is after running the above code the application becomes very slow and even if I trying to move the map using mouse it not responding immediately. Can someone tell me what can be the issue and how to resolve it.