Skip to main content

Calendar widget for Tkinter

Project description

tkcalendar

tkcalendar is a calendar widget for Tkinter. It is compatible with both Python 2 and Python 3. It support all locale setting supported by the system and the colors are customizable.

Requirements

  • Linux, Windows, Mac
  • Python 2 or 3 with tkinter + ttk (default for Windows but not for Linux)

Installation

  • Ubuntu:
$ dpkg -i python(3)-tkcalendar_x.y.z-1_all.deb
  • Archlinux: the package is available on AUR
  • With pip:
$ pip install tkcalendar

Documentation

Syntax:

Calendar(master=None, **kw)

Widget keyword options:

  • Standard options

    cursor: cursor to display when the pointer is in the widget

    font: font of the calendar, can be a string such as “Arial 20 bold” or a Tkinter Font instance

  • Widget-Specific Options

    year, month: initially displayed month, default is current month

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

    locale: locale to use, e.g. “fr_FR” for a French calendar

    selectmode: “none” or “day” (default) define whether the user can change the selected day with a mouse click

    background: border and month/year name background color

    foreground: border and month/year name foreground color

    selectbackground: selected day background color

    selectforeground: selected day foreground color

    normalbackground: normal week days background color

    normalforeground: normal week days foreground color

    othermonthforeground: foreground color for days belonging to the previous/next month

    weekendbackground: week-end days background color

    weekendforeground: week-end days foreground color

    headersbackground: day names and week numbers background color

    headersforeground: day names and week numbers foreground color

  • Virtual Events

    A <<CalendarSelected>> event is generated each time the selected day changes.

Changelog

  • tkcalendar 1.0.0
    • Initial version

Example

try:
    from tkinter import Tk, Button
except ImportError:
    from Tkinter import Tk, Button
from tkcalendar import Calendar

def print_sel():
    print(cal.selection_get())

root = Tk()

cal = Calendar(root, locale="fr_FR.UTF-8",
               font="Arial 12",
               cursor="hand1", year=2018, month=2, day=5)
cal.pack(fill="both", expand=True)
Button(root, text="ok", command=print_sel).pack()

root.mainloop()

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for tkcalendar, version 1.0.0
Filename, size File type Python version Upload date Hashes
Filename, size tkcalendar-1.0.0-py3.6.egg (14.3 kB) File type Egg Python version 3.6 Upload date Hashes View
Filename, size tkcalendar-1.0.0-py3-none-any.whl (9.5 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size tkcalendar-1.0.0.tar.gz (7.5 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page