Python | GUI Calendar using Tkinter

by anupmaurya
0 comment 4367 views

In this article, we will learn how to create a GUI Calendar application using Tkinter

Python offers multiple options for developing a GUI (Graphical User Interface). Out of all the GUI methods, Tkinter is the most commonly used method. Python with Tkinter outputs the fastest and easiest way to create GUI applications. 

To create GUI Calendar Using Python, we will need

  • To import two Python modules one for creating GUI and another to get year data.

For GUI we will use "tkinter module" because it’s very easy to learn and use.

And to get any year data we will use "calendar module".

To install Tkinter and calendar module, go to terminal and type,

pip install tkinter
Code language: Python (python)
pip install calendar module
Code language: Python (python)
  • Create the main window (container)
  • Add any number of widgets to the main window.
  • Apply the event Trigger on the widgets.

Code with comments: GUI calendar using Python

from tkinter import * import tkinter as tk from PIL import ImageTk, Image import calendar root = tk.Tk() root.geometry('400x300') root.title('Calender-Techarge') root.iconbitmap("calender-ico.ico") def show(): m = int(month.get()) y = int(year.get()) output = calendar.month(y,m) cal.insert('end',output) def clear(): cal.delete(1.0,'end') def exit(): root.destroy() img = ImageTk.PhotoImage('calendar.png')) label = Label(image=img),y=3) m_label = Label(root,text="Month",font=('verdana','10','bold')),y=80) month = Spinbox(root, from_= 1, to = 12,width="5"),y=80) y_label = Label(root,text="Year",font=('verdana','10','bold')),y=80) year = Spinbox(root, from_= 2020, to = 3000,width="8"),y=80) cal = Text(root,width=33,height=8,relief=RIDGE,borderwidth=2),y=110) show = Button(root,text="Show",font=('verdana',10,'bold'),relief=RIDGE,borderwidth=2,command=show),y=250) clear = Button(root,text="Clear",font=('verdana',10,'bold'),relief=RIDGE,borderwidth=2,command=clear),y=250) exit = Button(root,text="Exit",font=('verdana',10,'bold'),relief=RIDGE,borderwidth=2,command=exit),y=250) root.mainloop()
Code language: Python (python)


Python | GUI Calendar using Tkinter

Here, we have made a very simple and short program, but you can make this GUI application more user-friendly like you can add entry widgets to get the year during the run time and show the specific year’s calendar by clicking on a button.

In case, you don’t know how to create your GUI application more friendly or how to add more functionalities to your GUI application read more at

ThankYou Pythoner’s!!!

Check out more python projects

You may also like