From 5291b72b3f7e1ab22078f1a4188e6c7c8489407d Mon Sep 17 00:00:00 2001 From: hahnec Date: Tue, 14 Sep 2021 18:17:45 +0200 Subject: [PATCH] fix(tk): add alternative PhotImage import using tkinter #23 --- plenopticam/gui/widget_view.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/plenopticam/gui/widget_view.py b/plenopticam/gui/widget_view.py index 294a8ef..7895561 100644 --- a/plenopticam/gui/widget_view.py +++ b/plenopticam/gui/widget_view.py @@ -25,11 +25,16 @@ except ImportError: import Tkinter as tk -from PIL import Image, ImageTk, ImageFont, ImageDraw +from PIL import Image, ImageFont, ImageDraw import os, sys from functools import partial import glob +try: + from PIL.ImageTk import PhotoImage +except: + PhotoImage = tk.PhotoImage + from plenopticam.lfp_extractor import LfpViewpoints from plenopticam.misc.os_ops import get_img_list from plenopticam import __version__ @@ -142,7 +147,7 @@ def show_image(self, arg=None): next_frame = self.get_dummy # set tk frame as member variable as it gets lost otherwise - self.tk_frame = ImageTk.PhotoImage(next_frame) + self.tk_frame = PhotoImage(next_frame) self.delete(self.find_withtag("bacl")) self.allready = self.create_image(PX*4, PY*4, image=self.tk_frame, anchor=tk.NW, tag="bacl")