Registry / ttkbootstrap

ttkbootstrap

JSON →
library1.20.3pypypi✓ verified 86d ago

ttkbootstrap is a supercharged theme extension for tkinter that provides modern flat-style themes inspired by Bootstrap. It offers a wide range of pre-built widgets and styles, making it easy to create visually appealing and responsive GUI applications with Tkinter. The library is actively maintained with frequent minor and patch releases, typically every few weeks.

pip install ttkbootstrap
INSTALL
IMPORT
SIG · TTKBOOTSTRAP
T
ttkbootstrap
pythonv1.20.3
Install
2.3s avg
Import
Disk
37MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v1.20.3 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.910 runs
installs and imports cleanly · install 0.0s · import 0.000s · 39MB
glibc
py 3.103.910 runs
installs and imports cleanly · install 2.3s · import 0.000s · 40MB
37MB installed
● package 37MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Window
import ttkbootstrap as tb app = tb.Window(themename="flatly")
The primary entry point for a themed Tkinter application.
PhotoImage
from ttkbootstrap import PhotoImage
Required for displaying images. Often used with `Label` or `Button` widgets.
Messagebox
from ttkbootstrap.dialogs import Messagebox
from ttkbootstrap.dialog import Messagebox
Prior to v1.19.1, some dialogs (like `Dialog` itself) might have been referenced from `ttkbootstrap.dialog` but the correct path for pre-built dialogs is now `ttkbootstrap.dialogs`.

This quickstart creates a simple ttkbootstrap application with a themed window, a label, and a button. The `Window` class automatically sets up a themed Tkinter root window. Experiment with different `themename` values like 'darkly', 'superhero', or 'flatly' for varying aesthetics.

import ttkbootstrap as tb def main(): app = tb.Window(themename="cosmo") # Try 'darkly', 'superhero', 'flatly', etc. app.title("My ttkbootstrap App") app.geometry("400x200") label = tb.Label(app, text="Hello from ttkbootstrap!", font=('Helvetica', 16)) label.pack(pady=30) button = tb.Button(app, text="Click Me", command=lambda: label.config(text="Button Clicked!"), bootstyle="primary") button.pack(pady=10) app.mainloop() if __name__ == '__main__': main()
Debug
Known issues
breakingttkbootstrap dropped support for Python 3.9 in version 1.19.0. Applications using Python 3.9 or older will fail to install or run with newer versions.
fix
Upgrade your Python environment to 3.10 or newer. The current recommended minimum is Python 3.10.
affects: >=1.19.0
deprecatedThe import path for certain dialog classes, such as `Dialog` (for creating custom dialogs), changed from `ttkbootstrap.dialog` to `ttkbootstrap.dialogs` in version 1.19.1. While `ttkbootstrap.dialogs` now holds pre-built dialogs like `Messagebox`, the base `Dialog` class also moved there.
fix
Update import statements from `from ttkbootstrap.dialog import Dialog` to `from ttkbootstrap.dialogs.dialog import Dialog` for custom dialogs, or `from ttkbootstrap.dialogs import Messagebox` for pre-built ones.
affects: >=1.19.1
gotchaWhen using `PhotoImage` objects (e.g., for icons on buttons or labels), ensure you maintain a reference to the image object. If the `PhotoImage` object is garbage collected, the image will disappear from the widget.
fix
Assign the `PhotoImage` object to an instance variable of a class or a global variable to prevent it from being garbage collected. Example: `self.icon = PhotoImage(file='icon.png'); button.config(image=self.icon)`.
affects: All
Errors
Common errors & fixes
TclError: image "pyimageX" doesn't exist
A `PhotoImage` object used by a widget (e.g., a button or label) has been garbage collected because no strong reference to it was maintained.
fix
Store the `PhotoImage` object as an attribute of the widget's parent (e.g., `self.my_image = PhotoImage(...)`) or as a global variable. This ensures it remains in memory as long as the widget needs it.
ModuleNotFoundError: No module named 'ttkbootstrap.dialog'
Attempting to import dialogs (like `Dialog` or `Messagebox`) from an old path that was removed or changed in `ttkbootstrap` v1.19.1 and later.
fix
Update your import statement. For general dialogs, use `from ttkbootstrap.dialogs import Messagebox` or `Querybox`. For the base custom `Dialog` class, use `from ttkbootstrap.dialogs.dialog import Dialog`.
AttributeError: 'Window' object has no attribute 'mainloop'
Often happens if `tb.Window()` is called but the `mainloop()` method is not invoked at the end of the script to start the Tkinter event loop.
fix
Ensure `app.mainloop()` (where `app` is your `tb.Window` instance) is called at the very end of your application's setup code to start the GUI event loop.
Upgrade
Version history
1.20.3latest on PyPI · released May 7, 2026
Audit
Dependencies
PillowrequiredRequired for image handling and certain widgets (e.g., icons). Specific versions are often pinned in `ttkbootstrap`.
Agent activity
2 hits · last 30 days
node
2
Resources
ttkbootstrap — pip install ttkbootstrap · libregistry