#!C:\Python38\Python

import datetime
import tkinter as tk
from PIL import Image,ImageTk

window=tk.Tk()
window.geometry("300x400")
window.title(" Age Calculator App ")

name = tk.Label(text = "Name")
name.grid(column=0,row=1)
year = tk.Label(text = "Year")
year.grid(column=0,row=2)
month = tk.Label(text = "Month")
month.grid(column=0,row=3)
date = tk.Label(text = "Day")
date.grid(column=0,row=4)

nameEntry = tk.Entry()
nameEntry.grid(column=1,row=1)
yearEntry = tk.Entry()
yearEntry.grid(column=1,row=2)
monthEntry = tk.Entry()
monthEntry.grid(column=1,row=3)
dateEntry = tk.Entry()
dateEntry.grid(column=1,row=4)

def getInput():
    name=nameEntry.get()
    year=int(yearEntry.get())
    age = 2022-year

    textArea = tk.Text(master=window,height=10,width=25)
    textArea.grid(column=1,row=6)
    answer = " Hi {}!!!. You are {} years old!!! ".format(name, age)
    textArea.insert(tk.END,answer)

button=tk.Button(window,text="Calculate Age",command=getInput)
button.grid(column=1,row=5)

image=Image.open('mypage.jpg')
image.thumbnail((200,500),Image.ANTIALIAS)
photo=ImageTk.PhotoImage(image)
label_image=tk.Label(image=photo)
label_image.grid(column=1,row=0)
window.mainloop()
