Skip to content

Commit

Permalink
bug: osx needs PIL to read png?
Browse files Browse the repository at this point in the history
  • Loading branch information
WillForan2009 committed Apr 19, 2021
1 parent 0288986 commit 16f618d
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,15 @@ def show_mni_slice(win, show_file=None):
"""setup example slice image. implemented but unused 20210415"""
if show_file is None:
show_file = os.path.dirname(os.path.abspath(__file__)) + '/slice_atlas.png'
exslice_img = tkinter.PhotoImage(file=show_file)
try:
exslice_img = tkinter.PhotoImage(file=show_file)

except tkinter.TclError:
# pip install pillow
import PIL.Image
import PIL.ImageTk
exslice_img = PIL.ImageTk.PhotoImage(PIL.Image.open(show_file))

mni_img = tkinter.Label(win)
mni_img.image = exslice_img
mni_img.configure(image=exslice_img)
Expand Down

0 comments on commit 16f618d

Please sign in to comment.