When loading my tkinter, the background of the DateEntry box remains white. I have attempted all kinds of styling but still no luck.
# Create a custom style for DateEntry
style = ttk.Style(root)
style.configure("CustomDateEntry.TCombobox", fieldbackground="#FF9393", background="#FF9393")
style.configure('CustomDateEntry.TEntry', fieldbackground="#FF9393", background="#FF9393")
start_date_entry = DateEntry(
booking_window,
style="CustomDateEntry.TEntry",
date_pattern="yyyy-mm-dd" # Ensure the date format is correct
)
start_date_entry.configure(style='CustomDateEntry.TEntry')
start_date_entry.place(
x=824.0,
y=242.0,
width=152.0,
height=22.0
)
I have tried all kinds of styling to make the background of the entry box pink but no luck.
According to the document on how to style DateEntry
widget, you need to use .DateEntry
as the reference to create custom style. Also it may need to use another theme instead of the default one:
style = ttk.Style(root)
style.theme_use('winnative') # works in Windows
style.configure('custom.DateEntry', fieldbackground="#FF9393", background="#FF9393")
start_date_entry = DateEntry(
booking_window,
style="custom.DateEntry",
date_pattern="yyyy-mm-dd" # Ensure the date format is correct
)
Result: