Skip to content

Commit 16f618d

Browse files
committed
bug: osx needs PIL to read png?
1 parent 0288986 commit 16f618d

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

gui.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,15 @@ def show_mni_slice(win, show_file=None):
5353
"""setup example slice image. implemented but unused 20210415"""
5454
if show_file is None:
5555
show_file = os.path.dirname(os.path.abspath(__file__)) + '/slice_atlas.png'
56-
exslice_img = tkinter.PhotoImage(file=show_file)
56+
try:
57+
exslice_img = tkinter.PhotoImage(file=show_file)
58+
59+
except tkinter.TclError:
60+
# pip install pillow
61+
import PIL.Image
62+
import PIL.ImageTk
63+
exslice_img = PIL.ImageTk.PhotoImage(PIL.Image.open(show_file))
64+
5765
mni_img = tkinter.Label(win)
5866
mni_img.image = exslice_img
5967
mni_img.configure(image=exslice_img)

0 commit comments

Comments
 (0)