Tkinter Date picker Entry box using DateEntry for user to select read and set the date from calendar

plus2net
plus2net
23.9 هزار بار بازدید - 3 سال پیش - DateEntry is part of tkcalendar
DateEntry is part of tkcalendar library. This can be installed by using
Pip install tkcalendar
In Command prompt.
We can display the DateEntry without specifying year month and day and by default it will show the current date and default selected date.
We can specify any date as default date like this
cal=DateEntry(my_w,selectmode='day',year=2021,month=8,day=17)
We can use string variable and assign it to textvariable option of the DateEntry. Once the selection is changed then the string variable value will change. By using trace() method of String variable we can trigger the function my_upd().
Inside the function my_upd() we will read the selected date by using get() method and assign the text option of a Label by using config().
We can also use button to trigger the reading and displaying of selected date, here we will not use any string variable as the event can be triggered by command option of the button.
Inside the function my_upd() we can read the selected date by using get_date() method of the DateEntry and assign the same to one label l1 by using config() method.
We can change the date format by using strftime() function.
While displaying the  DateEntry we can pre select any date by suing set_date() method.  The method set_date() takes date object as input and set the date.

https://www.plus2net.com/python/tkint...

#tkinter #DateEntry #DatePicker #calendarDateEntry #plus2net #set_date #get_date #entryDate #calendarDate
3 سال پیش در تاریخ 1400/06/05 منتشر شده است.
23,925 بـار بازدید شده
... بیشتر