Entry

A single-line text field. TEntry is the themed version (preferred); Entry is the classic one. They share the same methods and most options.

Example

const name = app.TEntry({ width: 30 });
name.value = 'Guest';
name.pack.configure({ padx: 16, pady: 8 });

console.log(name.value); // the current text

Options

Option Type Description
textVariable StringVar Two-way bind the contents to a variable.
show string Display each character as this (e.g. '*' for a password).
state string 'normal', 'readonly', or 'disabled'.
justify string 'left', 'center', 'right'.
width number Width in characters.
placeholder string Hint text shown while the field is empty.
font string Text font.
style string A ttk style name (TEntry only).

Methods

Method Description
value Property: get or set the whole contents (a string).
getText() The current contents (same as reading value).
insert(index, text) Insert text at a character index (or 'end').
delete(first, last?) Delete a character range.
clear() Remove all text.
icursor(index) Move the insertion cursor.

Plus the inherited widget methods — see Widget basics.

See also