Tkinter Date Picker
First you have to install tkcalendar
by saying this, in your terminal:
pip install tkcalendar
Here is a simple example on tkcalendars DateEntry
:
from tkinter import *from tkinter import ttkfrom tkcalendar import DateEntryroot = Tk()e7 = DateEntry(root, values="Text", year=2020, state="readonly", date_pattern="yyyy-mm-dd")e7.grid(row=1, column=1, padx=20, pady=5, sticky=W)root.mainloop()
You could also use tkcalendars Calendar
:
from tkcalendar import Calendare7 = Calendar(root, values="Text", year=2020, state="readonly", date_pattern="yyyy-mm-dd")e7.grid(row=1, column=1, padx=20, pady=5, sticky=W)
For your case, you can use two of any of these widgets to get (e7.selection_get()
) the start date and the end date and then work with it.
Here is the documentation for more information on the widget
Hope it cleared your doubts, if you have errors, do let me know
Cheers