DateEntry#

DateEntry is a composite widget that ttkbootstrap ships (ttk.DateEntry) — an Entry paired with a button that opens a calendar popup for picking a date. The chosen date is written back into the entry, and a <<DateEntrySelected>> virtual event fires. This page is the complete lookup reference.

Each option can be passed to the constructor and changed later with configure().

Options#

Option

Type

Description

bootstyle

str

The focus color of the entry and the color of the date button — one of primary, secondary, success, info, warning, danger, light, dark. Default "primary".

date_format

str

The strftime format used to render the date in the entry. Default "%x" (the locale’s date representation).

first_weekday

int

The first day of the week in the popup: 0 = Monday … 6 = Sunday. Default 6.

start_date

datetime | date

The date the calendar popup focuses on when no date is selected. When value is omitted it also fills the field at construction and is the get_date() fallback for an empty field. Default None (today).

value

datetime | date | None

The initially selected date. Pass value=None for an empty, clearable field — get_date() / value then return None until a date is chosen. If omitted, the field defaults to start_date or today.

button_icon

str

The Bootstrap-Icons glyph shown on the button. Default "calendar-week".

show_outside_days

bool

Whether the popup shows the leading/trailing days of adjacent months as muted, non-selectable labels. Default True.

state

str

"normal", "readonly", or "disabled". Queries return the entry field’s state; setting "normal" or "disabled" also applies to the date button.

raise_exception

bool

Whether an invalid typed date raises ValueError. When False, a bad string is ignored with a warning. Default False.

position

tuple

Optional (x, y) screen coordinates for the popup. Default None (positioned near the widget).

popup_title

str

Retained for API compatibility; not displayed, because the popup is borderless. Default "Select new date".

A width passed via **kwargs is applied to the entry field, not the container frame.

Methods#

get_date()

Return the currently selected date.

Returns:

the selected date, or None if the entry is empty / invalid.

Return type:

datetime | None

set_date(new_date)

Set the selected date and update the entry text. Passing None clears the field (equivalent to clear()).

Parameters:

new_date (datetime | date | None) – the date to display, or None to clear the field.

Returns:

None.

clear()

Clear the selected date, leaving the field empty. Afterwards value / get_date() return None and the calendar popup opens on the configured start_date (or today).

Returns:

None.

enable()

Enable the entry and date button.

Returns:

None.

disable()

Disable the entry and date button.

Returns:

None.

value

The currently selected date (property; a synonym for get_date()). Assigning None clears the field. Returns None when the field is empty in the nullable model (see the value option).

enabled

Whether the date picker is currently enabled (read-only property).

Styling options#

A DateEntry is an Entry beside a button, so its field and button follow the Entry and Button styles. The drop-down calendar has its own style family:

Bootstyle mapping#

Any of the accent colors – primary, secondary, success, info, warning, danger, light, dark – substitutes for primary below. neutral does not apply to this family.

bootstyle

ttk style name

primary

primary.TCalendar

Layout (elements)#

The widget is drawn from these nested parts. Each is an element you can target by name in a custom layout:

Toolbutton.border
  Toolbutton.focus
    Toolbutton.padding
      Toolbutton.label

Configurable style options#

Options you can set with style.configure(...) / style.map(...):

anchor, background, bordercolor, borderwidth, compound, darkcolor, embossed, focuscolor, focussolid, focusthickness, font, foreground, image, justify, lightcolor, padding, relief, shiftrelief, space, stipple, text, underline, width, wraplength

Supported states#

The states you can target with style.map(...) to vary appearance by interaction:

!disabled, disabled, hover, pressed, selected

Hand-styling example#

import ttkbootstrap as ttk

app = ttk.App()
style = app.style

style.configure("my.TCalendar", background="#3498db", foreground="white")

# This style backs an internal/shipped widget rather than a
# directly-constructed ttk widget; configure the style class above.

Shared capabilities#

DateEntry also has the methods every widget inherits — configuration, placement, event binding, lifecycle, focus, and introspection. These are documented under Capabilities.

See also#