I know it is possible to embed an image in a Tkinter text widget, but I\'ve been unable to find some simple example code. Specifically, I need to embed a jpg, so according t
PhotoImage
only handles GIF
and PGM/PPM
files. In order to use JPEG
with Tkinter, you can use the Python Imaging Library (PIL) to create a PhotoImage
.
from PIL import Image, ImageTk
img = Image.open("yourimg.jpg")
photoImg = ImageTk.PhotoImage(img)
Alternatively you could just one of the other supported formats for PhotoImage
if possible.