From f9f9ed833e2dd4613e5d2d317865fa8e0b95ed3e Mon Sep 17 00:00:00 2001 From: Jakob Cornell Date: Sun, 29 Dec 2024 15:15:47 -0600 Subject: [PATCH] Force TkAgg Matplotlib backend on macOS This fixes a crash caused by closing a generated plot window in the app. --- main.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/main.py b/main.py index 5128bc6..edf7f22 100644 --- a/main.py +++ b/main.py @@ -800,9 +800,10 @@ class AutoJsonStorageMgr: json.dump(data, f) -# This seems to be necessary for Pyinstaller builds; not sure why. +# The "macosx" backend is chosen by default on macOS and doesn't seem to play well with Tk. +# https://discuss.python.org/t/tkinter-pyplot-crashes-appkit-on-macos/75590 if sys.platform == "darwin": - matplotlib.use("macosx") + matplotlib.use("TkAgg") model = MainModel(AutoJsonStorageMgr('data'), AutoJsonStorageMgr('state')) view = MainView() -- 2.30.2