AutocompleteEntry

An entry that suggests completions as you type — cities, tags, commands. The entry keeps focus the whole time: the suggestion popup never grabs and never steals keystrokes; ↓/↑ highlight, Enter accepts, Escape dismisses, clicking a suggestion accepts it.

Live preview

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

Example

const city = app.AutocompleteEntry({
  values: ['Berlin', 'Bern', 'Bratislava', 'Brno', 'Brussels'],
});
city.bind('<<AutocompleteSelected>>', () => console.log('picked:', city.value));
city.pack.configure({ anchor: 'w', padx: 16, pady: 8 });

city.values = await loadCities(); // swap candidates any time

Matching is a case-insensitive prefix match; suggestions appear while there is text and at least one match, and follow focus out. Free text that matches nothing is perfectly valid — this is an entry with help, not a combobox with a lock.

Options

Option Type Description
values array The candidate list (any strings, spaces welcome).
maxItems number Visible suggestion rows before the list scrolls (default 8).
textVariable StringVar Bind the entry text.
width number Entry width in characters.
state string 'normal' or 'disabled' (disabled never pops up).

Accepting a suggestion (Enter or click) fires <<AutocompleteSelected>> on the widget. The accessible role is combobox.

See also