I am new to python GUI programming, I want to add a image in my tkinter label, I have created the following code but the window is not showing my image. Path of image is the same folder as this code.
import ImageTk
import Tkinter as tk
from Tkinter import *
from PIL import Image
def make_label(master, x, y, w, h, img, *args, **kwargs):
f = Frame(master, height = h, width = w)
f.pack_propagate(0)
f.place(x = x, y = y)
label = Label(f, image = img, *args, **kwargs)
label.pack(fill = BOTH, expand = 1)
return label
if __name__ == '__main__':
root = tk.Tk()
frame = tk.Frame(root, width=400, height=600, background='white')
frame.pack_propagate(0)
frame.pack()
img = ImageTk.PhotoImage(Image.open('logo.png'))
make_label(root, 0, 0, 400, 100, img)
root.mainloop()