DateEntry
A date field. The typed entry is the primary input — validated against the date format, normalized on commit — and the calendar button (or pressing Down in the entry) opens a fully keyboard-navigable month popup.
Live preview
Live preview. In the Player's built-in docs viewer (
scriptweaver --help), this rendersDateEntryas a live, theme-aware widget you can interact with.
Example
const due = app.DateEntry({
value: '2026-06-11',
});
due.bind('<<DateEntrySelected>>', () => console.log('picked:', due.value));
due.pack.configure({ anchor: 'w', padx: 16, pady: 8 });
Typing and validation
Typed input commits on Return or when focus leaves the field. A parsable
date is normalized to the canonical format (2026-6-3 → 2026-06-03);
anything else sets the entry's invalid state and keeps the text for
correction — value reads '' until the input is valid again. Assigning an
unparsable value from code throws. An impossible date (2026-02-29) is
invalid, not silently adjusted.
The calendar popup
Open it with the calendar button or Down in the entry. Navigation is all keyboard: ←/→ a day, ↑/↓ a week, PgUp/PgDn a month, Home/End first/last of the month, Return/Space picks, Escape closes, and clicking anywhere outside dismisses it. Today is tinted, the selection is filled, adjacent-month days are dimmed (and clickable). Month changes and picks are announced to screen readers.
From code, de.open() and de.close() drive the popup (a disabled field won't
open) — handy for a "pick a date" affordance elsewhere in your UI.
Options
| Option | Type | Description |
|---|---|---|
value |
string | The date, in dateFormat. '' = empty. Setting an unparsable value throws. |
dateFormat |
string | A Tcl clock format spec; default '%Y-%m-%d' (ISO). Changing it re-expresses the current value. |
firstWeekday |
string | 'monday' (default) or 'sunday'. |
textVariable |
StringVar |
Bind the raw entry text. |
width |
number | Entry width in characters (default 12). |
state |
string | 'normal' or 'disabled' (a disabled field won't open the popup). |
Picking a date — from the popup, by typing, or by assigning value — fires
<<DateEntrySelected>> on the widget (only when the committed value actually
changed):
due.bind('<<DateEntrySelected>>', onChange);
See also
Entry— the plain text field- Events & binding
- Accessibility