Garima Tiwari
Garima Tiwari

Reputation: 1540

Simple drop-down calendar + date picker in Python

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

Answers (2)

Ali BENALI
Ali BENALI

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

clozano
clozano

Reputation: 1

First:

pip install panel

Second:

import panel as pn
pn.extension()

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

Upvotes: 0

Related Questions