Creating a datepicker widget
If we want to let users input a date into our application, we might add a text entry that forces them to write a string with a valid date format. Another solution would be adding several numeric entries for the day, month, and year, but this would also require some validations.
Unlike other GUI frameworks, Tkinter does not include a class for this purpose; however, we can opt to apply our knowledge of themed widgets to build a Calendar widget.
Getting ready
In this recipe, we will explain a step-by-step implementation of a datepicker widget made with Ttk widgets and features:

This is a refactored version ofhttp://svn.python.org/projects/sandbox/trunk/ttk-gsoc/samples/ttkcalendar.pyand does not require any external packages.
How to do it...
Apart from the tkinter
modules, we will also need the calendar
and datetime
modules from the Standard Library. They will help us to model and interact with the data held by the widget.
The widget header displays a couple of arrows...