I created a gui using Python Tkinter. It is a publication year search and whenever a user inputs a year value for example, 2021, the corresponding image will be displayed.
I am having difficulty as when I click the search button, nothing appears.
This is my code:
import tkinter
from tkinter import *
from tkinter import ttk
from PIL import Image, ImageTk
main = Tk()
main.geometry("750x250")
main.title("Publication Year Search")
L1 = Label(main, text="Publication Year", fg='black')
L1.grid(row=0, column=0, padx=5, pady=10)
def getDate():
date = int(EB.get())
if date == 2021:
load = Image.open("pic-1.png")
render = ImageTk.PhotoImage(load)
img = Label(main, image=render)
img.grid(row=3,column=3)
EB = Entry(main, width=10)
EB.grid(row=0, column=2)
buttonSub = Button(main, text='Search', command=getDate)
buttonSub.grid(row=3, column=2)
main.mainloop()