3

Trying to create a simple drop-down calendar with a date picker in Python such that a field drops down to show a calendar where after a date is selected is captured - I have not yet come across a clean, simple and short code for Python 3.6.1. Therefore, need help with creating a simple drop down date picker in Python.

EDIT : I was not able to access Calendar, DateEntry widgets from the package tkcalendar earlier and therefore created a class to render the same using the answer below.

Garima Tiwari
  • 1,490
  • 6
  • 28
  • 46

2 Answers2

6

first pip install tkcalendar then

import tkinter as tk

from tkcalendar import DateEntry
root = tk.Tk()
cal = DateEntry(root, width=12, year=2019, month=6, day=22, 
background='darkblue', foreground='white', borderwidth=2)
cal.pack(padx=10, pady=10)
root.mainloop()
Ali
  • 687
  • 8
  • 27
0

First:

pip install panel

Second:

import panel as pn
pn.extension()

pn.widgets.DatePicker(name='Set Starting Date')