From db7230c3ec2679701c0c36bc68872f48dd8bde80 Mon Sep 17 00:00:00 2001 From: Neko Asakura Date: Fri, 20 Dec 2024 04:13:27 +1000 Subject: [PATCH 1/2] ext/pyrender/viewer: clean up unused imports --- genesis/ext/pyrender/viewer.py | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/genesis/ext/pyrender/viewer.py b/genesis/ext/pyrender/viewer.py index f9f68cc5..4a08d36b 100644 --- a/genesis/ext/pyrender/viewer.py +++ b/genesis/ext/pyrender/viewer.py @@ -14,15 +14,8 @@ import genesis as gs -try: - from Tkinter import Tk - from Tkinter import tkFileDialog as filedialog -except Exception: - try: - from tkinter import Tk - from tkinter import filedialog as filedialog - except Exception: - pass +from tkinter import Tk +from tkinter import filedialog import pyglet from moviepy.video.io.ffmpeg_writer import FFMPEG_VideoWriter From d8f6bedf922d0f1fa4f2a408ed7e21c02c7a55a8 Mon Sep 17 00:00:00 2001 From: Neko Asakura Date: Fri, 20 Dec 2024 04:18:37 +1000 Subject: [PATCH 2/2] ext/pyrender/viewer: resolve macOS crashes when initialising Tk() --- genesis/ext/pyrender/viewer.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/genesis/ext/pyrender/viewer.py b/genesis/ext/pyrender/viewer.py index 4a08d36b..c2f2e2da 100644 --- a/genesis/ext/pyrender/viewer.py +++ b/genesis/ext/pyrender/viewer.py @@ -16,6 +16,8 @@ from tkinter import Tk from tkinter import filedialog +root = Tk() +root.withdraw() import pyglet from moviepy.video.io.ffmpeg_writer import FFMPEG_VideoWriter @@ -961,7 +963,6 @@ def _get_save_filename(self, file_exts): } filetypes = [file_types[x] for x in file_exts] try: - root = Tk() save_dir = self.viewer_flags["save_directory"] if save_dir is None: save_dir = os.getcwd() @@ -971,7 +972,6 @@ def _get_save_filename(self, file_exts): except Exception: return None - root.destroy() if filename == (): return None return filename