Skip to content
Related Articles

Related Articles

Improve Article

Create a Date Picker Calendar – Tkinter

  • Last Updated : 05 Jul, 2021

Prerequisite: 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. It is a standard Python interface to the Tk GUI toolkit shipped with Python. Python with Tkinter is the fastest and easiest way to create GUI applications. In this article, we will learn how to create a date picker calendar in Tkinter.

In Tkinter, there is no in-built method for date picker calendar, here we will use the tkcalendar Module.

tkcalendar: tkcalendar is a Python module that provides the Calendar and DateEntry widgets for Tkinter. 

For installation run this command into your terminal:

pip install tkcalendar


  • First, we will import the required library
  • Then we will create a Calendar Object and pass the default date
  • Pick the year, month, and date from the calendar
  • For getting the value of the picked date value, use the get() method.

Syntax: Calendar(master=None, **kw)

year: intCode block

  • it initially displayed year, default is the current year.

month: int

  • initially displayed month, default is the current month.

day: int

  • initially selected day, if month or year is given but not day, no initial selection, otherwise, default is today.

Below is the Implementation:-


# Import Required Library
from tkinter import *
from tkcalendar import Calendar
# Create Object
root = Tk()
# Set geometry
# Add Calendar
cal = Calendar(root, selectmode = 'day',
               year = 2020, month = 5,
               day = 22)
cal.pack(pady = 20)
def grad_date():
    date.config(text = "Selected Date is: " + cal.get_date())
# Add Button and Label
Button(root, text = "Get Date",
       command = grad_date).pack(pady = 20)
date = Label(root, text = "")
date.pack(pady = 20)
# Excecute Tkinter






 Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.  

To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course. And to begin with your Machine Learning Journey, join the Machine Learning – Basic Level Course

My Personal Notes arrow_drop_up
Recommended Articles
Page :