ttkbootstrap

1.20.2 · active · verified Fri Apr 17

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.

Common errors

Warnings

Install

Imports

Quickstart

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()

view raw JSON →