Images can be shown with tkinter. Images can be in a variety of formats including jpeg images. A bit counterintuitive, but you can use a label to show an image.

To open an image use the method This will look for images in the programs directory, for other directories add the path to the filename.

Related course: Tkinter GUI Application Development Projects



This example loads and shows an image on a label. It’s as simple as showing text on the tkinter window, but instead of text we show an image.

You should install the Python Imaging Library (PIL) to load images. This is required and the module is available in PyPi. Install that module with the pip package manager.

It can open various image formats including PPM, PNG, JPEG, GIF, TIFF, and BMP.

To load an image:

load ="parrot.jpg")
render = ImageTk.PhotoImage(load)

Then associate it with the label:

img = Label(self, image=render)
img.image = render, y=0)

tkinter image

tkinter image example

You can open a window, add a label and associate an image with it. In this example we load a jpeg image but you can load any image.

A complete example below:

from tkinter import *

# pip install pillow
from PIL import Image, ImageTk

class Window(Frame):
def __init__(self, master=None):
Frame.__init__(self, master)
self.master = master
self.pack(fill=BOTH, expand=1)

load ="parrot.jpg")
render = ImageTk.PhotoImage(load)
img = Label(self, image=render)
img.image = render, y=0)

root = Tk()
app = Window(root)
root.wm_title("Tkinter window")

Download Tkinter examples