Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG FIX] ext/pyrender/viewer: resolve macOS crashes when initialising Tk() #92

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 4 additions & 11 deletions genesis/ext/pyrender/viewer.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,10 @@

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
Comment on lines -17 to -25
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The purpose of this code is to ensure compatibility with Tkinter, supporting both Python 2 and Python 3. Genesis requires Python 3.9 or higher, such compatibility adjustments are unnecessary.

requires-python = ">=3.9"

from tkinter import Tk
from tkinter import filedialog
root = Tk()
root.withdraw()
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hide root window as we only use filedialog to save image.


import pyglet
from moviepy.video.io.ffmpeg_writer import FFMPEG_VideoWriter
Expand Down Expand Up @@ -968,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()
Expand All @@ -978,7 +972,6 @@ def _get_save_filename(self, file_exts):
except Exception:
return None

root.destroy()
if filename == ():
return None
return filename
Expand Down