Entry
Entry is the low-level, single-line text input primitive in bootstack.
It wraps bs.Entry and integrates bootstack styling plus reactive text support. Entry is also the building block
used by higher-level controls like TextEntry, NumericEntry, DateEntry, and PasswordEntry.
Quick start
import bootstack as bs
app = bs.App()
entry = bs.Entry(app)
entry.pack(padx=20, pady=20)
app.mainloop()
When to use
Use Entry when:
-
you need direct, low-level access to
bs.Entryoptions -
you are building your own composite control
-
you want Tk's
validate/validatecommandbehavior
Consider a different control when...
-
you want labels, helper text, and standardized events - prefer TextEntry
-
you want commit-based validation with messages - prefer TextEntry
-
you are building application forms - prefer TextEntry or specialized input controls
Appearance
accent / style
Use semantic tokens via accent, or provide a concrete ttk style via style=.
bs.Entry(app, accent="primary")
bs.Entry(app, accent="secondary")
Design System
See the Design System for available color tokens.
Examples and patterns
Value model
Entry works with raw text:
-
entry.get()returns the current string -
textvariable=ortextsignal=keeps the text synchronized with your state
Unlike field controls such as TextEntry, Entry does not define "text vs committed value" semantics on its own.
textvariable
Bind to a Tk variable.
name = bs.StringVar(value="Ada")
bs.Entry(app, textvariable=name).pack()
textsignal
Bind to a reactive signal (no Tk variable needed).
entry = bs.Entry(app, textsignal=my_signal)
show
Mask input characters (useful for basic password-style entry).
bs.Entry(app, show="*")
Password input
For a full-featured password field (reveal toggle, validation, messages), prefer PasswordEntry.
Tk validation (validate / validatecommand)
Use Tk's validation when you need per-keystroke constraints.
def validate_text(new_value: str) -> bool:
return new_value.isdigit() or new_value == ""
vcmd = (app.register(validate_text), "%P")
entry = bs.Entry(app, validate="key", validatecommand=vcmd)
entry.pack(padx=20, pady=20)
Prefer field controls for forms
For most form UX, prefer TextEntry (commit-time parsing + validation messages + consistent events).
Behavior
Entry follows standard Tk/ttk behavior:
-
keyboard focus and caret navigation
-
standard widget states (
normal,readonly,disabled) -
standard Tk events like
<KeyRelease>and<FocusOut>
entry.bind("<KeyRelease>", lambda e: print(entry.get()))
Events
Entry emits standard Tk events, not structured v2 field events.
If you want standardized field events like on_input / on_changed, use TextEntry.
Validation and constraints
Use Entry validation when you need low-level, immediate constraints while typing.
If you want user-friendly validation messages and commit-based validation, prefer TextEntry (or a specialized *Entry control).
Additional resources
Related widgets
-
TextEntry - form-ready text control with labels, messages, and events
-
PasswordEntry - specialized masked input control
-
NumericEntry - numeric input with bounds and stepping
-
Combobox - selection with optional text entry