A collection of ttk themes inspired by Bootstrap
Project description
ttkbootstrap
A collection of modern themes for Tkinter TTK built using standard, cross-platform themes ('clam', 'alt', 'classic', 'default'). Most of these themes are adapted and or/inspired from the open source bootstrap themes published on https://bootswatch.com/
Installation
pip install ttkbootstrap
Basic Usage
from ttkbootstrap import BootStyle, ttk
style = BootStyle()
style.theme_use('flatly')
root = style.master
# create widget with primary colors
ttk.Label(root, text='Hello world').pack()
# create widget with other colors
ttk.Label(root, text='Hello world', style='danger.TLabel').pack()
# run the window
root.mainloop()
Applying Styles
By default, the primary color for the theme will be used on widgets (See images below for examples of theme color options). All other themed colors can be used by applying the color prefix to the ttk widget class.
ttk.Label(root, text='Hello World', style='info.TLabel')
ttk.Button(root, text='Hello World', style='info.TButton')
ttk.Button(root, text='Hello World', style='warning.Outline.TButton')
ttk.Radiobutton(root, text='Hello World', style='danger.TRadiobutton')
Color prefixes
- primary (default)
- secondary
- success
- info
- warning
- danger
Defined ttk widget classes
- TButton
- Outline.TButton
- TSpinbox
- Horizontal.TScale
- Vertical.TScale
- Horizontal.TScrollbar
- Vertical.TScrollbar
- TCombobox
- TFrame
- TCheckbutton
- TEntry
- TLabel
- TLabelframe
- TNotebook
- TMenubutton
- Outline.TMenubutton
- Horizontal.TProgressbar
- Vertical.TProgressbar
- TRadiobutton
- Treeview
Exceptions
- The Scale widget is built with an image set in the primary theme color; this cannot be changed via styles.
- The Checkbutton and Radiobutton colors are only changeable on Linux and MacOS. Windows uses the built-in "xpnative" themed elements to build the widgets.
Create New Themes
Creating a new theme is easy... simply add a theme record to the themes.json
file with the appropriate fields
{
"name": "cosmo",
"font": "Helvetica",
"type": "light",
"colors": {
"primary": "#2780e3",
"secondary": "#373a3c",
"success": "#3fb618",
"info": "#9954bb",
"warning": "#ff7518",
"danger": "#ff0039",
"bg": "#ffffff",
"fg": "#373a3c",
"selectbg": "#373a3c",
"selectfg": "#ffffff",
"light": "#fdfdfe",
"border": "#ced4da",
"inputfg": "#49506a"
}
}
Light Themes
Dark Themes
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for ttkbootstrap-0.0.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 38c48e0ce1beaa87c1a1ef9eb563626faa51e4802771c8d335dafd661d161596 |
|
MD5 | fbd76b05b20faad507baa902d99e6a22 |
|
BLAKE2b-256 | 99bf564774ca025edd63daebbc9b86f824f0203b2a766dd9af8a214aa5f176cd |