Skip to main content

Font-based icons for Tkinter/ttkbootstrap with a built-in Bootstrap set and installable providers: Font Awesome, Material, Ionicons, Remix, Fluent, Simple, Weather, Lucide.

Project description

ttkbootstrap-icons

Font-based icons for Tkinter/ttkbootstrap with a built-in Bootstrap set and installable providers: Font Awesome, Material, Ionicons, Remix, Fluent, Simple, Weather, Lucide.

Features

  • Built-in set: Bootstrap Icons
  • Pluggable providers: Font Awesome, Material, Ionicons, Remix, Fluent, Simple, Weather, Lucide
  • Style variants where available (e.g., Font Awesome solid/regular/brands, etc...)
  • Previewer app: search, style selector, size/color controls, click-to-copy; auto-discovers installed providers
  • Cross‑platform; includes PyInstaller hook for bundling assets

Installation

pip install ttkbootstrap-icons

Optional providers (install any you want):

pip install ttkbootstrap-icons-fa       # Font Awesome (Free)
pip install ttkbootstrap-icons-fluent   # Fluent System Icons
pip install ttkbootstrap-icons-gmi      # Google Material Icons (baseline/outlined/round/sharp/twotone)
pip install ttkbootstrap-icons-ion      # Ionicons v2 (font)
pip install ttkbootstrap-icons-lucide   # Lucide Icons
pip install ttkbootstrap-icons-mat      # Material Design Icons (MDI)
pip install ttkbootstrap-icons-remix    # Remix Icon
pip install ttkbootstrap-icons-simple   # Simple Icons (community font)
pip install ttkbootstrap-icons-weather  # Weather Icons

Quick Start

Bootstrap Icons

import tkinter as tk
from ttkbootstrap_icons import BootstrapIcon

root = tk.Tk()

# Create a Bootstrap icon
icon = BootstrapIcon("house", size=32, color="blue")

# Use it in a label
label = tk.Label(root, image=icon.image)
label.pack()

root.mainloop()

Provider Icons (examples)

import tkinter as tk
from ttkbootstrap_icons_fa import FAIcon  # Font Awesome
from ttkbootstrap_icons_lucide import LucideIcon  # Lucide

root = tk.Tk()

fa = FAIcon("house", size=24, color="#0d6efd", style="solid")
luc = LucideIcon("home", size=24, color="#dc3545")

tk.Button(root, image=fa.image, text="FA House", compound="left").pack()
tk.Button(root, image=luc.image, text="Lucide Home", compound="left").pack()

root.mainloop()

API Reference

BootstrapIcon

BootstrapIcon(name: str, size: int = 24, color: str = "black")

Parameters:

  • name: The name of the Bootstrap icon (e.g., "house", "search", "heart")
  • size: Size of the icon in pixels (default: 24)
  • color: Color of the icon (default: "black"). Accepts any valid Tkinter color string

Attributes:

  • image: Returns the PhotoImage object that can be used in Tkinter widgets

Advanced Usage

Using Icons in Different Widgets

from ttkbootstrap_icons import BootstrapIcon, LucideIcon
import tkinter as tk

root = tk.Tk()

# In a Button
icon1 = BootstrapIcon("gear", size=24, color="#333333")
btn = tk.Button(root, image=icon1.image, text="Settings", compound="left")
btn.pack()

# In a Label
icon2 = LucideIcon("alert-circle", size=48, color="orange")
lbl = tk.Label(root, image=icon2.image)
lbl.pack()

# Keep references to avoid garbage collection
root.icon1 = icon1
root.icon2 = icon2

root.mainloop()

Transparent Icons

You can create a transparent placeholder icon using the special name "none":

transparent_icon = BootstrapIcon("none", size=24)

Icon Previewer

Browse installed icon sets with search, styles, size and color controls. The previewer auto‑discovers any provider packages you have installed.

Using the CLI Command

After installing the package:

ttkbootstrap-icons

Features:

  • Shows all installed providers (Bootstrap built‑in; others optional)
  • Style selector for sets that provide variants (e.g., FA, Fluent, Material Icons)
  • Real‑time search filtering
  • Adjustable icon size (16–128 px)
  • Color customization with presets
  • Virtual scrolling for smooth performance
  • Fixed window for consistent layout

Controls:

  • Icon Set: Choose among installed icon sets
  • Style: Select a style variant when available
  • Search: Filter icons by name (case‑insensitive)
  • Size: Set preview size
  • Color: Enter any Tkinter color (hex, names)
  • Presets: Quick color buttons
  • Click to Copy: Click any icon to copy its name

Icon Previewer

Perfect for discovering the right icon for your project!

Using with PyInstaller

This package includes built-in PyInstaller support. The icon assets (fonts and metadata) will be automatically included when you freeze your application.

Basic Usage

pip install pyinstaller
pyinstaller --onefile your_app.py

With Hook Directory (Automatic)

The package includes a PyInstaller hook that automatically bundles the required assets. In most cases, PyInstaller will detect and use this hook automatically.

Manual Hook Configuration (If Needed)

If the automatic detection doesn't work, you can manually specify the hook directory:

# your_app.spec file or command line
pyinstaller - -additional - hooks - dir = path / to / site - packages / ttkbootstrap_icons / _pyinstaller
your_app.py

Or in your .spec file:

a = Analysis(
    ['your_app.py'],
    ...
hookspath = ['path/to/site-packages/ttkbootstrap_icons/_pyinstaller'],
...
)

Programmatic Hook Discovery

from ttkbootstrap_icons import get_hook_dirs

# Use in your build script
hook_dirs = get_hook_dirs()

Testing Your Frozen Application

After building with PyInstaller, test that icons load correctly:

./dist/your_app  # Linux/Mac
dist\your_app.exe  # Windows

Cleanup Temporary Files

Icons create temporary font files. To clean them up when your app exits:

import atexit
from ttkbootstrap_icons import Icon

# Register cleanup on exit
atexit.register(Icon.cleanup)

Requirements

  • Python >= 3.10
  • Pillow >= 9.0.0

License

MIT License - see LICENSE file for details

Author

Israel Dryer (israel.dryer@gmail.com)

Links

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ttkbootstrap_icons-2.0.0.tar.gz (560.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ttkbootstrap_icons-2.0.0-py3-none-any.whl (560.9 kB view details)

Uploaded Python 3

File details

Details for the file ttkbootstrap_icons-2.0.0.tar.gz.

File metadata

  • Download URL: ttkbootstrap_icons-2.0.0.tar.gz
  • Upload date:
  • Size: 560.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.3

File hashes

Hashes for ttkbootstrap_icons-2.0.0.tar.gz
Algorithm Hash digest
SHA256 5f3cc10eb5ce1d7252d54222e6225b0eb4a382a4692305b72ca5325cf4a21be6
MD5 ed1fdade4b0d58b0c6c308047b2d3207
BLAKE2b-256 2f347c8f0ca0282f8cb169379f15e7bb17455ead6c5ef2d16ef25372aa884ad2

See more details on using hashes here.

File details

Details for the file ttkbootstrap_icons-2.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for ttkbootstrap_icons-2.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 22ce77a12d736cfcef9695ac8375451101adbe56db22e1126a1f086eec28612a
MD5 0792f1fac8ff1a6da96a303fe4387bf7
BLAKE2b-256 3950bad733e09b7733cee67b98edcfba3158a207468091c153d60dc6a1d72e5c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page