Untitled
unknown
plain_text
3 years ago
640 B
4
Indexable
Never
from tkinter import * root = Tk() root.title("Leap Year Checker") def checkLeapYear(year): if(year % 4 == 0): if(year % 100 == 0): if(year % 400 == 0): label.config(text="The year is a leap year") else: label.config(text="The year is not a leap year") else: e.insert(0, "The year is not a leap year") e = Entry(root, borderwidth=5) e.grid(row=0, column=0) year = int(e.get()) checkButton = Button(root, text="Check", padx=20, pady=3, command=lambda:checkLeapYear(year)) checkButton.grid(row=0, column=1) label = Label(root) label.grid(row=1, column=0, columnspan=2) label.configure(anchor=CENTER) root.mainloop()