Repository navigation
Port microgcs to Python 3 and update the GUI from the main thread - #1257
Open
Abhayindia wants to merge 2 commits into
Open
Abhayindia wants to merge 2 commits into
Abhayindia wants to merge 2 commits into
Conversation
This was referenced Sep 20, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Second finding from the SITL examples sweep in #1255. Two separate bugs in
examples/gcs/microgcs.py, both of which stop it dead on Python 3.1.
from Tkinter import *is the Python 2 spelling. Python 3 renamed the module to lowercasetkinter, so the example fails at import:2. With that fixed, it segfaults. The GUI callbacks write to Tk widgets from DroneKit's MAVLink thread, and Tkinter widgets may only be touched from the thread running
mainloop():I isolated this rather than guessing: commenting out the three
addObserverAndInit(...)calls and changing nothing else makes it survive indefinitely, which pins the crash on the attribute callbacks specifically. The fix routes each update throughroot.after(0, ...)so the widget write happens on the main loop's thread.Verified against
dronekit-sitl copter(APM:Copter 3.3): before, it core-dumps within seconds of connecting; after, it runs with all three observers live for 45s until I stop it, with the labels updating.Branched off
master, independent of #1253 and of #1256.One caveat I would rather state than hide: I exercised this on a real X display and confirmed the window renders and updates, but I did not click the Auto/RTL buttons, because setting a flight mode does not work against the bundled SITL at all. That is a separate problem with its own root cause, which I will write up on #1255 rather than fold in here.