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 ttkbootstrapVerified import paths — ran on the pinned version, not inferred.
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.
Upgrade your Python environment to 3.10 or newer. The current recommended minimum is Python 3.10.
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.
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)`.
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.
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`.
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.