tkcalendar is a third-party Python package that adds graphical calendar widgets to Tkinter applications. Its Calendar widget displays a full calendar for selecting dates, navigating months, restricting date ranges and marking events.
Calendar when the full calendar should remain visible. Use DateEntry when you need a compact Entry field with a drop-down calendar.tkcalendar does not come with Python's standard Tkinter installation. Install it separately:
python -m pip install tkcalendar

Import the Calendar class with:
from tkcalendar import Calendar
import tkinter as tk
from tkcalendar import Calendar
root=tk.Tk()
root.geometry('380x300')
root.title('tkcalendar - plus2net')
cal=Calendar(root, selectmode='day', year=2026, month=9, day=6)
cal.pack(padx=20, pady=20)
root.mainloop()

The important initial options are:
selectmode='day'
year=2026
month=9
day=6
If no year, month or day is supplied, the Calendar opens on the current date.
cal=Calendar(root, selectmode='day')
There is an important detail when only some date components are supplied. If a year or month is explicitly supplied without a day, the calendar can open on that month without initially selecting a day.
If an exact default date is required, provide all three values:
cal=Calendar(root, year=2026, month=9, day=6)
or use selection_set() after creating the widget.
get_date() returns the selected date as a string formatted according to the Calendar's locale and date_pattern.
print(cal.get_date())
For example, depending on the configured pattern:
9/6/26
or:
06-09-2026

import tkinter as tk
from tkcalendar import Calendar
def show_date():
label.config(text=cal.get_date())
root=tk.Tk()
root.geometry('380x320')
cal=Calendar(root, selectmode='day')
cal.pack(pady=15)
tk.Button(root, text='Read Date', command=show_date).pack(pady=5)
label=tk.Label(root, text='', bg='yellow')
label.pack(pady=10)
root.mainloop()
selection_get() returns the selected date as a Python datetime.date object.
selected=cal.selection_get()
print(selected)
print(type(selected))
Sample Output
2026-09-06
<class 'datetime.date'>
This form is useful when the application needs date arithmetic, database storage or custom formatting.
| Method | Returns | Best For |
|---|---|---|
get_date() | Formatted string | Displaying the selected date |
selection_get() | datetime.date | Date calculations and custom formatting |

The Calendar generates <<CalendarSelected>> when the user selects a day with the mouse.
import tkinter as tk
from tkcalendar import Calendar
def date_selected(event):
label.config(text=cal.get_date())
root=tk.Tk()
cal=Calendar(root, selectmode='day')
cal.pack(padx=20, pady=20)
cal.bind('<<CalendarSelected>>', date_selected)
label=tk.Label(root, text='Select a date')
label.pack(pady=10)
root.mainloop()
<<CalendarSelected>> when you specifically want to react after the user selects a date. A linked StringVar is useful when the variable itself must also be monitored.A StringVar can still be connected to the Calendar:
selected_text=tk.StringVar()
cal=Calendar(root, textvariable=selected_text)
Then:
print(selected_text.get())
returns the formatted selected date string.
selection_set() changes the currently selected date.
from datetime import date
cal.selection_set(date(2026, 9, 6))
This is usually preferable to a string because it does not depend on the current locale's date format.
A date string is also accepted when it matches the Calendar's locale/date format.
cal.selection_set('09/06/2026')
09/06/2026 can mean different dates under different date conventions. Prefer a datetime.date object when the application already knows the year, month and day.cal.selection_clear()
Because selection_get() returns a datetime.date, standard Python strftime() formatting can be used.
def show_date():
selected=cal.selection_get()
if selected:
formatted=selected.strftime('%d-%m-%Y')
label.config(text=formatted)

For a month name:
formatted=selected.strftime('%d-%B-%Y')
Sample Output
06-September-2026
You do not have to use selection_get() merely to change the string returned by get_date(). The Calendar itself supports date_pattern.
cal=Calendar(root, date_pattern='dd-mm-yyyy')
Now:
print(cal.get_date())
can return:
06-09-2026
| Pattern | Meaning |
|---|---|
d | Day without leading zero |
dd | Two-digit day |
m | Month without leading zero |
mm | Two-digit month |
yy | Two-digit year |
yyyy | Full year |
tkcalendar date_pattern uses patterns such as dd-mm-yyyy, while Python strftime() uses codes such as %d-%m-%Y.The selected date and the currently displayed month are separate concepts. A user can navigate to another month without selecting a new day.
get_displayed_month() returns:
(month, year)

import tkinter as tk
from tkcalendar import Calendar
def month_changed(event=None):
month, year=cal.get_displayed_month()
label.config(text=f'Month={month:02d}, Year={year}')
root=tk.Tk()
root.title('Calendar Month and Year')
cal=Calendar(root)
cal.grid(row=0, column=0, padx=10, pady=10)
label=tk.Label(root, text='', font=('Arial', 14))
label.grid(row=1, column=0, pady=10)
cal.bind('<<CalendarMonthChanged>>', month_changed)
month_changed()
root.mainloop()
<<CalendarMonthChanged>> runs when the displayed month changes, while <<CalendarSelected>> runs when the user selects a date.
mindate and maxdate limit which dates can be selected.

import tkinter as tk
from tkcalendar import Calendar
from datetime import date
root=tk.Tk()
root.title('Calendar Date Range')
min_date=date(2026, 9, 10)
max_date=date(2026, 10, 25)
cal=Calendar(root, selectmode='day', year=2026, month=9, day=10, mindate=min_date, maxdate=max_date)
cal.pack(padx=20, pady=20)
root.mainloop()
Dates outside the permitted range cannot be selected.
More mindate and maxdate Examplescal=Calendar(root, locale='en_US')
The locale affects displayed month/day names and default string date formatting.
cal=Calendar(root, firstweekday='sunday')
The other supported value is:
firstweekday='monday'
cal=Calendar(root, showweeknumbers=False)
cal=Calendar(root, showothermonthdays=False)

import tkinter as tk
from tkcalendar import Calendar
root=tk.Tk()
root.title('Customized Calendar')
cal=Calendar(
root,
selectmode='day',
background='#e0f7fa',
foreground='#000000',
headersbackground='#004d40',
headersforeground='#ffffff',
selectbackground='#00796b',
selectforeground='#ffffff',
normalbackground='#b2dfdb',
normalforeground='#000000',
font=('Arial', 11)
)
cal.pack(padx=20, pady=20)
root.mainloop()
Useful appearance options include:
| Option | Controls |
|---|---|
background | Calendar navigation/header background |
foreground | Calendar foreground |
headersbackground | Weekday header background |
headersforeground | Weekday header text |
selectbackground | Selected date background |
selectforeground | Selected date text |
normalbackground | Normal weekday background |
normalforeground | Normal weekday text |
weekendbackground | Weekend background |
weekendforeground | Weekend text |

calevent_create() attaches an event to a date. Tags control how event dates are displayed.
import tkinter as tk
from tkcalendar import Calendar
from datetime import date
root=tk.Tk()
cal=Calendar(root, year=2026, month=9, day=6)
cal.pack(padx=20, pady=20)
cal.calevent_create(date(2026, 9, 10), 'Project deadline', 'important')
cal.calevent_create(date(2026, 9, 18), 'Team meeting', 'meeting')
cal.tag_config('important', background='red', foreground='white')
cal.tag_config('meeting', background='lightblue', foreground='black')
root.mainloop()
The text attached to the event can appear in the event tooltip, while the tag controls the date's foreground and background colors.
| Method | Purpose |
|---|---|
calevent_create(date, text, tags) | Create an event and return its event ID. |
calevent_configure(id, ...) | Change an existing event. |
calevent_cget(id, option) | Read an event option. |
calevent_remove(...) | Remove calendar events. |
get_calevents() | Return event IDs, optionally filtered by date or tag. |
tag_config(tag, ...) | Configure a tag's foreground/background. |
tag_cget(tag, option) | Read a tag option. |
tag_delete(tag) | Delete a tag and remove it from events. |
tag_names() | Return the existing tag names. |
event_id=cal.calevent_create(date(2026, 9, 10), 'Deadline', 'important')
print(event_id)
The returned ID can later be used to edit or remove that specific event.
| Method | Purpose |
|---|---|
get_date() | Return selected date as a formatted string. |
selection_get() | Return selected date as datetime.date, or None when there is no selection. |
selection_set(date) | Set the selected date. |
selection_clear() | Clear the current date selection. |
get_displayed_month() | Return (month, year) for the month currently displayed. |
see(date) | Navigate the Calendar to the month containing a given date. |
format_date(date) | Format a datetime.date using the Calendar's locale and date pattern. |
keys() | Return the available widget option names. |
configure(...) | Change Calendar options after creation. |
from datetime import date
cal.see(date(2027, 1, 15))
This displays January 2027. It does not by itself mean that January 15 must become the selected date.
| Option | Purpose |
|---|---|
year, month, day | Initial displayed/selected date components. |
selectmode | 'day' enables date selection; 'none' disables day selection. |
textvariable | Links the formatted selected date to a Tkinter variable. |
date_pattern | Controls the string format returned by get_date(). |
locale | Controls localized names and default date representation. |
mindate, maxdate | Restrict selectable date range. |
firstweekday | Choose Monday or Sunday as the first weekday. |
showweeknumbers | Show or hide week numbers. |
showothermonthdays | Show or hide adjacent-month days. |
state | normal or disabled. |
font | Calendar font. |
background, foreground | Main color settings. |
selectbackground, selectforeground | Selected date colors. |
tooltipbackground, tooltipforeground | Calendar-event tooltip colors. |
tooltipdelay | Delay before an event tooltip is displayed. |
print(cal.keys())
It is a separate package and must normally be installed:
python -m pip install tkcalendar
get_date() uses date_pattern, so this is valid:
cal=Calendar(root, date_pattern='dd-mm-yyyy')
print(cal.get_date())
cal.get_date() # formatted string
cal.selection_get() # datetime.date
Prefer:
cal.selection_set(date(2026, 9, 6))
over an ambiguous string such as:
'09/06/2026'
For a user choosing a date from the Calendar, use:
cal.bind('<<CalendarSelected>>', callback)
Use selection_get() for the selected date and get_displayed_month() for the month currently shown while navigating.
Keep the initial selected date within the permitted selection range.
This is a tkcalendar pattern:
date_pattern='dd-mm-yyyy'
This is Python strftime() syntax:
selected.strftime('%d-%m-%Y')
If the interface only needs one date-entry field, consider:
Tkinter tkcalendar DateEntrytkcalendar is a third-party package that adds Calendar and DateEntry widgets to Tkinter.python -m pip install tkcalendar.Calendar().get_date() returns the selected date as a formatted string.date_pattern controls the string returned by get_date().selection_get() returns the selected date as a datetime.date.selection_set() to change the selected date.datetime.date object when setting known dates programmatically.selection_clear() to clear the selected date.<<CalendarSelected>> when the user selects a date.<<CalendarMonthChanged>> when the displayed month changes.get_displayed_month() returns the displayed (month, year).mindate and maxdate to restrict selectable dates.locale and date_pattern to control date presentation.firstweekday, showweeknumbers and showothermonthdays to adjust calendar layout.calevent_create() to mark dates with events.see(date) to navigate to the month containing a date.DateEntry when a compact date-entry field is more suitable than a permanently visible Calendar.Author & Instructor at plus2net
I write and maintain practical tutorials on Python, PHP, SQL, JavaScript, HTML, jQuery, and web development at plus2net. The tutorials focus on clear explanations, working examples, and code that readers can test and adapt while learning.