# import all methods and classes from the tkinterfromtkinterimport*# import calendar moduleimportcalendar# Function for showing the calendar of the given yeardefshowCal():# Create a GUI windownew_gui=Tk()# Set the background colour of GUI windownew_gui.config(background="white")# set the name of tkinter GUI windownew_gui.title("CALENDAR")# Set the configuration of GUI windownew_gui.geometry("550x600")# get method returns current text as stringfetch_year=int(year_field.get())# calendar method of calendar module return# the calendar of the given year .cal_content=calendar.calendar(fetch_year)# Create a label for showing the content of the calendarcal_year=Label(new_gui,text=cal_content,font="Consolas 10 bold")# grid method is used for placing# the widgets at respective positions# in table like structure.cal_year.grid(row=5,column=1,padx=20)# start the GUInew_gui.mainloop()# Driver Codeif__name__=="__main__":# Create a GUI windowgui=Tk()# Set the background colour of GUI windowgui.config(background="white")# set the name of tkinter GUI windowgui.title("CALENDAR")# Set the configuration of GUI windowgui.geometry("250x140")# Create a CALENDAR : label with specified font and sizecal=Label(gui,text="CALENDAR",bg="dark gray",font=("times",28,'bold'))# Create a Enter Year : labelyear=Label(gui,text="Enter Year",bg="light green")# Create a text entry box for filling or typing the information.year_field=Entry(gui)# Create a Show Calendar Button and attached to showCal functionShow=Button(gui,text="Show Calendar",fg="Black",bg="Red",command=showCal)# Create a Exit Button and attached to exit functionExit=Button(gui,text="Exit",fg="Black",bg="Red",command=exit)# grid method is used for placing# the widgets at respective positions# in table like structure.cal.grid(row=1,column=1)year.grid(row=2,column=1)year_field.grid(row=3,column=1)Show.grid(row=4,column=1)Exit.grid(row=6,column=1)# start the GUIgui.mainloop()