TimePicker

A typed time field where the keyboard is the picker: type a time and it validates and normalizes like a DateEntry, or put the caret on a segment and press ↑/↓ — hours, minutes (by step) or seconds move, wrapping through midnight. On an empty field, ↑ seeds the current time.

Live preview

Live preview. In the Player's built-in docs viewer (scriptweaver --help), this renders TimePicker as a live, theme-aware widget you can interact with.

Example

const departs = app.TimePicker({ value: '09:30', step: 5 });
departs.bind('<<TimePickerSelected>>', () => console.log(departs.value));
departs.pack.configure({ anchor: 'w', padx: 16, pady: 8 });

Typed input commits on Return or focus-out: parsable times normalize (9:509:05), anything else sets the entry's invalid state and keeps the text for correction (value reads '' meanwhile); impossible times (25:99) are invalid, not adjusted. Assigning an unparsable value throws.

Options

Option Type Description
value string The time, in timeFormat. '' = empty.
timeFormat string A Tcl clock format spec; default '%H:%M' (use '%H:%M:%S' for seconds, '%I:%M %p' for 12-hour). Changing it re-expresses the value.
step number The ↑/↓ minute increment, 1..59 (default 1; hours and seconds always move by one).
textVariable StringVar Bind the raw entry text.
width number Entry width in characters (default 8).
state string 'normal' or 'disabled'.

Committed changes — typed, stepped, or assigned — fire <<TimePickerSelected>> (only when the value actually changed).

See also