Tikinter Photoimage
Tkinter photoimage is a part of widgets to display an image on window. In GUI application developing using tkinter you need to display some image in your GUI application in python.
In my previous tutorial we have seen how to create GUI application with tikinter now in this tutorial we will see how to display image in Tkinter window using Tkinter photoimage widgets.
In Tkinter library some widgets allow to display images for example lable, button. These widgets take and image argument that allow them to show images.
How to display image on Tkinter windows? || Tkinter PhotoImage
Simply you define the path of image in your widgets which you have place on window. Instead you need to create photoImage object and pass it the image argument.
Following are the simple steps to display image on label widgets
Step 01. Open Your Pycharm
Step 02. Intall tkinter module
from tkinter import *
step 03. Install PIL Packge
from PIL import ImageTk, Image
After instlling the PIL package in your python project you will see it in site package directory in the left side.
root = Tk() root.geometry("500x500") root.title("USER LOGIN")
Step 05. Place label widgets and define iamage path and image size
image = Image.open("G:\flat icon/update.png") photo = ImageTk.PhotoImage(image) lab = Label(image=photo) lab.pack()
root.mainloop()
Run the project