TomSchimansky / TomSchimansky/TkinterMapView

If I use the mouse to move or zoom the map, the next map.set_position centers intermittently in random places

Open
#55 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
743
Forks
110
PR merge metrics
No merged PRs in 30d

Description

Hi, I'm having a problem with a moving map for aircraft. If I just let it run it works great, but if I move the map display with the mouse or change the zoom with the mouse, the next time this code is run, it intermittently centers in Brazil. Once that happens, it never centers in the correct place again. Can you help?

This code runs on a timer:

            self.map_widget.set_position(self.address_lat, self.address_lon)
            if self.auto_zoom_flag.get() == True:
                # Set zoom level based on aircraft speed 1 is zoomed all the way out, 
                # 19 all the way in
                zoom_level = 19-int(flight_position_data[0].get("speed")/600*19)
                if zoom_level <= 3:
                    zoom_level = 3
                elif zoom_level >= 14: zoom_level = 14
                self.map_widget.set_zoom(zoom_level)
            self.airplaneMarker.set_position(self.aircraft_lat, self.aircraft_lon)

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the timer callback shown in the issue and trace the interaction between map_widget.set_position, map_widget.set_zoom, and mouse panning or zooming. Reproduce the problem by moving or zooming the map before the next callback, then verify that repeated updates continue centering on the requested aircraft coordinates rather than an unrelated location.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
desktop
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.