Python 3 Tkinter GUI Script to Make Age Calculator From DOB Using tk-calendar Library Full Project For Beginners

Python 3 Tkinter GUI Script to Make Age Calculator From DOB Using tk-calendar Library Full Project For Beginners


Welcome folks today in this blog post we will be making an age calculator in tkinter and tk-calendar library. All the full source code of application is shown below













Get Started




In order to get started you need to install tkinter and tk-calendar library by pip command as shown below


pip install tkinter


pip install tk-calendar



After installing all the libraries you need to make an file and copy paste the following code



import datetime
import tkinter as tk
import random
import webbrowser
from PIL import ImageTk
from PIL import Image
import PIL.ImageTk
from time import sleep
from tkinter import *

window = tk.Tk()
window.title("Go Corona Go!!!!")

image ="/Users/theshaikasad/Desktop/maxresdefault.jpg")
image.thumbnail((250, 250), PIL.Image.ANTIALIAS)
photo = ImageTk.PhotoImage(image)
label_image = tk.Label(image=photo)
label_image.grid(column=1, row=0)

year_label = tk.Label(text="Year: ")
year_label.grid(column=0, row=1)

month_label = tk.Label(text="Month: ")
month_label.grid(column=0, row=2)

day_label = tk.Label(text="Day: ")
day_label.grid(column=0, row=3)

name_label = tk.Label(text="Name: ")
name_label.grid(column=0, row=4)

year_entry = tk.Entry()
year_entry.grid(column=1, row=1)

month_entry = tk.Entry()
month_entry.grid(column=1, row=2)

day_entry = tk.Entry()
day_entry.grid(column=1, row=3)

name_entry = tk.Entry()
name_entry.grid(column=1, row=4)

calculate_now_button = tk.Button(text="Calculate now!!!!")
calculate_now_button.grid(column=1, row=5)

text23 = tk.Label(text="\nTHE SOLUTION: \n\n")
text23.grid(column=0, row=9)

img ="/Users/theshaikasad/Desktop/APLClwr_.jpg")
img.thumbnail((130, 130), PIL.Image.ANTIALIAS)
poto = ImageTk.PhotoImage(img)
label_img = tk.Label(image=poto)
label_img.grid(column=1, row=10)

corona_button = tk.Button(text="#1 solution for protection from the COVID-19!!!")
corona_button.grid(column=1, row=11)

def indication(event):
    user = Person(str(name_entry.get()),,
    precise = str( - user.birthdate)
    index1 = str(precise).index(',')-1
    precise = precise[:index1]
    text_label = tk.Label(text="Yo {}, your age is {} that means {}s of your life are gone".format(, user.age, precise))
    text_label.grid(column=1, row=6)

    text1 = tk.Label(text="A Deep Realization that life is finite: ")
    text1 = text1.grid(column=1, row=7)

    im ="/Users/theshaikasad/Desktop/VBu_t7ZIRVlWELIQ.jpg")
    im.thumbnail((100, 100))
    ph = ImageTk.PhotoImage(im)
    label_im = tk.Label(image=ph)
    label_im.image = ph
    label_im.grid(column=1, row=8)

def corona_sol(event):

corona_button.bind("<Button-1>", corona_sol)
calculate_now_button.bind("<Button-1>", indication)

class Person:
    def __init__(self, name, birthdate): = name
        self.birthdate = birthdate
        self.age = self.findAge()

    def findAge(self):
        s = ( - self.birthdate)
        s = str(s//360)
        s = s[:2]
        return int(s)

swamu = Person('Swami',, 11, 13))



See also  Python 3 Tkinter Astrology Zodiac Sign Calculator By Date of Birth GUI Script Desktop App Full Project For Beginners




Leave a Reply