Display encoded jpeg in Tkinter?

I want to display an encoded jpeg image file with Tkinter. But when I run my code it tells me “couldnt identify image file”. What am I doing wrong?

import Tkinter, base64
from PIL import ImageTk, Image

root = Tkinter.Tk()

ImageEncoded = #### the images data ####

ImageForTK = ImageTk.PhotoImage(data = ImageEncoded) ##### this is where the error occurs

panel = Tkinter.Label(root, image = ImageForTk)
panel.pack(side = “bottom”, fill = “both”, expand = “yes”)


You may want to ask on a Tkinter forum. From past posts I have seen others try to integrate Tkinter and Blender only to discover that there is no context. The context will be the context of TKinter, not Blender. This will eliminate most bpy.ops operations. So you may want to get up-to-speed on bpy.data manipulations.

I am not sure why people feel that Blender needs another GUI? There are limitations, but every language I have used has limitations. They are part of the definition. My advice is to ditch Tkinter and work on the core functionality of your Blender script.

I am not using this with blender. So this post isn’t really blender related but I couldnt find a better place to ask this question