Reputation: 1540
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.
Upvotes: 3
Views: 33226
Reputation: 745
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()
Upvotes: 6
Reputation: 1
First:
pip install panel
Second:
import panel as pn
pn.extension()
pn.widgets.DatePicker(name='Set Starting Date')
Upvotes: 0