User Guide#

Learn ttkbootstrap by working through it: set up and build your first window, grasp the core styling concepts (the bootstyle grammar and how styling is delivered), reach for a feature guide when you need a whole subsystem — fonts, localization, validation, windowing — or grab a how-to when you have a specific task in mind. For the complete lookup of every public name see the Reference; for the visual widget catalog see Widgets.

Getting Started#

Installation

Install from PyPI; supported Python versions.

Installation
Quickstart

Your first themed window; App vs Tk; choosing a theme.

Quickstart
Build your first app

A guided, end-to-end tutorial: a contact book with a form, validation, and a data table.

Build your first app
Structuring an app

App vs Tk, the single-root rule, and a real app skeleton.

Structuring an app
Migrating to 2.0

bootstyle strings, theme names, removed shims, and icons.

Migrating to 2.0

Foundations#

New to tkinter? These pages cover the mental models everything else builds on — how an app runs, how widgets are arranged, how they bind to your data, how they respond to input, and how ttkbootstrap styles them.

How a tkinter app runs

The event loop, mainloop, callbacks, after, and not freezing the UI.

How a tkinter app runs
The widget model

The widget tree, options (configure/cget), and ttk states.

The widget model
What tkinter wraps

The Tcl/Tk layer underneath — path names, dashed options, and how to read a TclError.

What tkinter wraps
Object lifetime

Why a label empties or an image vanishes — keeping variables, images, and fonts alive.

Object lifetime
Arranging widgets

The three geometry managers and when to use each — start here, then the grid and pack tutorials.

Arranging widgets
Variables & reactivity

Binding widgets to StringVar/IntVar/BooleanVar and reacting to changes.

Variables & reactivity
Events & callbacks

command, bind and event objects, virtual events, and after.

Events & callbacks
Styling with bootstyle

The canonical grammar for styling any widget, with the full reference table.

Styling with bootstyle
How styling is delivered

How the bootstyle API reaches your widgets — the widget subclasses, enable_global_api, bootify, and apply_bootstyle.

How styling is delivered

Feature guides#

Each subsystem, end to end — its concepts and its usage in one place.

Typography

Fonts and set_global_family over the standard named fonts.

Typography
Localization

L(), LocaleVar, set_locale, and live language switching.

Localization
Input validation

add_*_validation helpers and the @validator decorator.

Input validation
Variables

Variable types, traces (read/write/unset), computed fields, and LocaleVar.

Variables
Events

The binding system in depth — scope & bindtags, stopping events, and dispatching your own virtual events.

Events
Icons

Theme-aware Bootstrap Icons glyphs — the icon= keyword, apply_icon, and the standalone Icon image.

Icons
Windows

App/Toplevel setup, focus & modality, positioning, high-DPI, and the deferred-config seam.

Windows
Menus

Menu bars, submenus, stateful items, context menus, and the cross-platform macOS application menu.

Menus
Dialogs

Messagebox and Querybox, the date/font/color pickers, filedialog, and what each returns.

Dialogs
Theming & Colors

Choosing and switching themes, light/dark, the built-in catalog, reading the theme’s colors (style.colors, ramps), and building your own theme.

Theming & Colors
Custom styles

The custom style-construction toolkit — assets, layouts, and icons.

Custom styles

How-To#

Task-focused recipes — common tkinter jobs done the ttkbootstrap way.

Show images and icons

PhotoImage and Pillow, the keep-a-reference gotcha, and themed glyphs.

Show images and icons
Scroll long content

ScrolledFrame and ScrolledText for content that outgrows the window.

Scroll long content
Open a second window

A second Toplevel, a modal that returns a value, and the close button.

Open a second window
Run background work

after and worker threads, updating widgets safely from the main loop.

Run background work
Copy and paste text

The clipboard methods, the copy shortcut, and the current selection.

Copy and paste text
Handle callback errors

Take over report_callback_exception and deal with TclError.

Handle callback errors
Ring the system bell

A system beep to flag a rejected action or a finished job.

Ring the system bell
Mark a window busy

A wait cursor and a block on clicks while a slow job runs.

Mark a window busy
Animate a GIF

Frame-by-frame animation with PhotoImage and after.

Animate a GIF
Show a splash screen

A borderless startup window that hands off to the main one.

Show a splash screen
Set the app icon

The titlebar and taskbar icon, and the Windows .ico case.

Set the app icon