dateformat | The date format to be returned. Check all Date formats here. |
firstweekday | 0=Monday, 1=Tuesday ... To display on Calendar |
startdate | Datetime, the date to be infocus, default is current date |
bootstyle | Style keyword, options are primary, secondary, success,info,warning,danger, light, dark |
**kwargs | Other keyword arguments. |
import ttkbootstrap as ttk
from ttkbootstrap.constants import *
from datetime import date
my_w = ttk.Window()
my_w.geometry("420x300") # width and height
dt2=date(2023,12,30) # start date
de = ttk.DateEntry(dateformat='%Y-%m-%d',firstweekday=2,startdate=dt2)
de.grid(row=1, column=1, padx=10, pady=20)
my_w.mainloop()
import ttkbootstrap as ttk
from ttkbootstrap.constants import *
from datetime import date
my_w = ttk.Window()
my_w.geometry("520x320") # width and height
dt2=date(2023,12,30) # for startdate
sel=ttk.StringVar()
de = ttk.DateEntry(dateformat='%Y-%m-%d',firstweekday=2,startdate=dt2)
de.grid(row=1, column=1, padx=10, pady=20)
def my_upd():
l1.configure(text=de.entry.get()) # displaying date
b1=ttk.Button(my_w,text='Show date',command=lambda:my_upd())
b1.grid(row=1,column=2)
l1=ttk.Label(my_w,text='Date') # to display date here
l1.grid(row =1,column=3)
my_w.mainloop()
All ttkbootstrap styles are applied using the bootstyle parameter. We can use all the avilable styles and apply to DateEntry.import ttkbootstrap as ttk
from ttkbootstrap.constants import *
from datetime import date
my_w = ttk.Window()
my_w.geometry("700x200") # width and height
c,r=0,0
for my_style in my_w.style.colors: # List of styles
de = ttk.DateEntry(bootstyle=my_style)
de.grid(row=r, column=c, padx=2, pady=20)
c=c+1
if c==4:
c,r=0,1
my_w.mainloop()
de.configure(state='readonly')
#de.configure(state='disabled')
de.configure(state='invalid')