Aug-01-2022, 05:56 PM
i tried that and that isn't working either,i wasn't sure if it was the name of the image ,the path or what but i tried both as parameters when calling the function open_image(). but tkinter just opens the geometry window and the blank 200x200 Frame but no image.
i dont see what is going wrong here.
this is where i am grabbing the image: photo = ImageTk.PhotoImage(Image.open(image_name))
this is where i am creating the Label to pack the photo onto : photo_label = Label(image=photo)
then just pack the dang thing to the frame
and call the function with my image..
i dont see what is going wrong here.
this is where i am grabbing the image: photo = ImageTk.PhotoImage(Image.open(image_name))
this is where i am creating the Label to pack the photo onto : photo_label = Label(image=photo)
then just pack the dang thing to the frame
and call the function with my image..
from tkinter import * from PIL import ImageTk,Image root = Tk() root.geometry("400x400") def open_image(image_name): frame = Frame(root,width=200,height=200,bd=5,bg='white') frame.pack(pady=15) photo = ImageTk.PhotoImage(Image.open(image_name)) photo_label = Label(image=photo) photo_label.pack() open_image('babu.jpg') #the name of the image is babu.jpg root.mainloop()