The Label widget can be used for displaying an image.
1 2 3 4 5 6 7 8 9101112131415161718
importtkinterastkfromtkinterimportttk,PhotoImage# Image file pathimg_pizza=r"images/pizza.png"# Load the image into a format that Tk can use.tk_pizza=PhotoImage(file=img_pizza)# Create and initialize the labellbl_greeting=ttk.Label(root,text="Some Text.",image=tk_pizza)lbl_greeting.pack()root.mainloop()
If we want to show the image and some text in the label, we need to use the compound setting.