Skip to content

Commit aef47fe

Browse files
fix map and start window
1 parent 0539d11 commit aef47fe

1 file changed

Lines changed: 22 additions & 3 deletions

File tree

src/gui/maingui.py

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -379,13 +379,32 @@ def create_map_view(self):
379379
try:
380380
from tkintermapview import TkinterMapView
381381

382-
# Create the map widget
382+
# Create the map widget with explicit tile server
383383
map_widget = TkinterMapView(map_frame, width=800, height=600, corner_radius=0)
384384
map_widget.grid(row=0, column=0, sticky="nsew", padx=10, pady=10)
385385

386+
# Set initial tile server explicitly (fix for white map issue)
387+
try:
388+
map_widget.set_tile_server("https://a.tile.openstreetmap.org/{z}/{x}/{y}.png")
389+
except Exception as e:
390+
print(f"Warning: Could not set tile server: {e}")
391+
# Try alternative tile server
392+
try:
393+
map_widget.set_tile_server("https://tile.openstreetmap.org/{z}/{x}/{y}.png")
394+
except Exception as e2:
395+
print(f"Warning: Fallback tile server also failed: {e2}")
396+
386397
# Set initial position and zoom
387-
map_widget.set_position(0, 0)
388-
map_widget.set_zoom(2)
398+
map_widget.set_position(40.7128, -74.0060) # New York City as default
399+
map_widget.set_zoom(3)
400+
401+
# Force map refresh with error handling
402+
try:
403+
map_widget.update()
404+
# Schedule a delayed refresh to ensure tiles load properly
405+
self.root.after(1000, lambda: map_widget.update())
406+
except Exception as e:
407+
print(f"Warning: Map update failed: {e}")
389408

390409
# Add map style selector
391410
control_frame = ttk.Frame(map_frame)

0 commit comments

Comments
 (0)