ttkbootstrap
A supercharged theme extension for tkinter that enables on-demand modern flat style themes inspired by Bootstrap.
Top Related Projects
A gorgeous theme for Tkinter/ttk, based on the Sun Valley visual style ✨
A modern and customizable python UI-library based on Tkinter
An easy and fast way to create a Python GUI 🐍
Quick Overview
ttkbootstrap is a modern and customizable theme for Tkinter applications in Python. It provides a collection of pre-designed widgets and styles inspired by Bootstrap, allowing developers to create visually appealing and responsive graphical user interfaces (GUIs) with ease.
Pros
- Enhances the visual appeal of Tkinter applications with modern, Bootstrap-inspired designs
- Offers a wide range of pre-built themes and styles for quick customization
- Provides a consistent look and feel across different platforms
- Simplifies the process of creating professional-looking GUIs in Python
Cons
- May have a learning curve for developers unfamiliar with Tkinter or Bootstrap concepts
- Limited documentation compared to more established GUI frameworks
- Potential performance overhead due to additional styling layers
- Dependency on Tkinter, which may not be suitable for all types of applications
Code Examples
- Creating a simple button with ttkbootstrap:
import ttkbootstrap as ttk
root = ttk.Window(themename="darkly")
button = ttk.Button(root, text="Click me!", bootstyle="success")
button.pack(pady=20)
root.mainloop()
- Using a ttkbootstrap Meter widget:
import ttkbootstrap as ttk
root = ttk.Window(themename="cosmo")
meter = ttk.Meter(
root,
amountused=65,
metersize=180,
subtext="CPU Usage",
interactive=True,
)
meter.pack(pady=20)
root.mainloop()
- Creating a ttkbootstrap DateEntry widget:
import ttkbootstrap as ttk
root = ttk.Window(themename="litera")
date_entry = ttk.DateEntry(root)
date_entry.pack(pady=20)
root.mainloop()
Getting Started
To get started with ttkbootstrap, follow these steps:
-
Install ttkbootstrap using pip:
pip install ttkbootstrap
-
Import ttkbootstrap in your Python script:
import ttkbootstrap as ttk
-
Create a window and add widgets:
root = ttk.Window(themename="darkly") label = ttk.Label(root, text="Hello, ttkbootstrap!") label.pack(pady=20) root.mainloop()
This will create a simple window with a label using the "darkly" theme. Explore the documentation for more widgets and customization options.
Competitor Comparisons
A gorgeous theme for Tkinter/ttk, based on the Sun Valley visual style ✨
Pros of Sun-Valley-ttk-theme
- Offers a modern, Windows 11-inspired look
- Provides both light and dark themes out of the box
- Focuses on a specific aesthetic, which may appeal to users wanting a Windows-like appearance
Cons of Sun-Valley-ttk-theme
- Limited to a single theme style (Windows 11-inspired)
- Less extensive widget customization options
- Smaller community and fewer updates compared to ttkbootstrap
Code Comparison
Sun-Valley-ttk-theme:
import tkinter as tk
from tkinter import ttk
import sv_ttk
root = tk.Tk()
sv_ttk.set_theme("dark")
ttkbootstrap:
import ttkbootstrap as ttk
from ttkbootstrap.constants import *
root = ttk.Window(themename="darkly")
Sun-Valley-ttk-theme focuses on providing a Windows 11-like appearance with a simple theme switch, while ttkbootstrap offers a wider range of themes and styling options inspired by Bootstrap. ttkbootstrap generally provides more flexibility and customization, making it suitable for a broader range of applications. However, Sun-Valley-ttk-theme may be preferable for those specifically seeking a Windows 11-inspired look in their Tkinter applications.
A modern and customizable python UI-library based on Tkinter
Pros of CustomTkinter
- More modern and sleek appearance out of the box
- Built-in dark mode support
- Easier to create custom widgets and styles
Cons of CustomTkinter
- Smaller community and fewer resources compared to ttkbootstrap
- Less extensive documentation
- May require more manual styling for complex layouts
Code Comparison
CustomTkinter:
import customtkinter as ctk
root = ctk.CTk()
button = ctk.CTkButton(root, text="Click me!")
button.pack()
ttkbootstrap:
import ttkbootstrap as ttk
root = ttk.Window()
button = ttk.Button(root, text="Click me!")
button.pack()
Both libraries aim to enhance the appearance of Tkinter applications, but CustomTkinter focuses on a more modern look with built-in theming, while ttkbootstrap provides a wider range of pre-defined styles based on Bootstrap. CustomTkinter may be more suitable for developers looking for a fresh, contemporary UI, while ttkbootstrap might be preferred for its extensive documentation and larger community support.
An easy and fast way to create a Python GUI 🐍
Pros of Tkinter-Designer
- Allows designing GUI layouts visually using Figma
- Generates Python code from Figma designs automatically
- Supports custom themes and styling options
Cons of Tkinter-Designer
- Requires Figma for design process
- Limited to standard Tkinter widgets
- May produce less optimized code compared to manual implementation
Code Comparison
Tkinter-Designer (generated code):
from pathlib import Path
from tkinter import Tk, Canvas, Entry, Text, Button, PhotoImage
OUTPUT_PATH = Path(__file__).parent
ASSETS_PATH = OUTPUT_PATH / Path("./assets")
def relative_to_assets(path: str) -> Path:
return ASSETS_PATH / Path(path)
ttkbootstrap (manual implementation):
import ttkbootstrap as ttk
from ttkbootstrap.constants import *
root = ttk.Window(themename="darkly")
b1 = ttk.Button(root, text="Submit", bootstyle="success")
b1.pack(side=LEFT, padx=5, pady=10)
ttkbootstrap offers a more streamlined approach for creating modern-looking GUIs with pre-defined themes and styles, while Tkinter-Designer provides a visual design workflow that may be more intuitive for some users. ttkbootstrap requires manual coding but offers more control and potentially more efficient code, whereas Tkinter-Designer automates code generation but may produce less optimized results.
Convert
designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual CopilotREADME
ttkbootstrap
English | 䏿
A supercharged theme extension for tkinter that enables on-demand modern flat style themes inspired by Bootstrap.
ð Check out the documentation.
1.0+ is a complete rebuild of the library. If you are using version 0.5 you may run into issues trying to import themes with the themes.json as this has been removed from 1.0. You can now import and save themes directly using the ttkcreator.
Features
âï¸ Built-in Themes
Over a dozen curated dark and light themes.
âï¸ Pre-defined Styles:
Loads of beautiful pre-defined widget styles such as outline and round toggle buttons.
âï¸ Simple keyword API:
Apply colors and types using simple keywords such as primary and striped instead of the legacy approach of primary.Striped.Horizontal.TProgressbar. If you've used Bootstrap for web development, you are already familiar with this approach using css classes.
âï¸ Lots of new Widgets:
ttkbootstrap comes with several new beautifully designed widgets such as Meter, DateEntry, and Floodgauge. Additionally, dialogs are now themed and fully customizable.
âï¸ Built-in Theme Creator:
Want to create your own theme? Easy! ttkboostrap includes a built-in theme creator that enables you to easily build, load, expore, and apply your own custom themes.
Installation
python -m pip install ttkbootstrap
Simple Usage
Instead of using long, complicated ttk style classes, you can use simple keywords with the "bootstyle" parameter.
import ttkbootstrap as ttk
from ttkbootstrap.constants import *
root = ttk.Window(themename="superhero")
b1 = ttk.Button(root, text="Submit", bootstyle="success")
b1.pack(side=LEFT, padx=5, pady=10)
b2 = ttk.Button(root, text="Submit", bootstyle="info-outline")
b2.pack(side=LEFT, padx=5, pady=10)
root.mainloop()
The new keyword API is very flexible. The following examples all produce the same result:
bootstyle="info-outline"
bootstyle="info outline"
bootstyle=("info", "outline")
bootstyle=(INFO, OUTLINE)
Links
- Documentation: https://ttkbootstrap.readthedocs.io/en/latest/
- GitHub: https://github.com/israel-dryer/ttkbootstrap
Top Related Projects
A gorgeous theme for Tkinter/ttk, based on the Sun Valley visual style ✨
A modern and customizable python UI-library based on Tkinter
An easy and fast way to create a Python GUI 🐍
Convert
designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual Copilot