# Install the ttkbootstrap library using pip pip install ttkbootstrapDisplay Buttons with ttkbootstrap style
# Import required modules
import ttkbootstrap as ttk
from ttkbootstrap.constants import *
# Create main window
my_w = ttk.Window()
my_w.geometry("400x150") # Set window width and height
# Create success button
b1 = ttk.Button(my_w, text="Button Success", bootstyle=SUCCESS)
b1.grid(row=0, column=0, padx=30, pady=30)
# Create primary button
b1 = ttk.Button(my_w, text="Button Primary", bootstyle=PRIMARY)
b1.grid(row=0, column=1, padx=30, pady=30)
# Run main event loop
my_w.mainloop()
import ttkbootstrap as ttk
from ttkbootstrap.constants import *
my_w = ttk.Window()
my_w.geometry("520x200")
c=0
for my_style in my_w.style.colors: # List of styles
b = ttk.Button(my_w, text=my_style, bootstyle=my_style)
b.grid(row=1, column=c, padx=2, pady=20)
b = ttk.Button(my_w, text=my_style, bootstyle=(my_style, OUTLINE))
b.grid(row=2, column=c, padx=2, pady=20)
c = c + 1
my_w.mainloop()
import ttkbootstrap as ttk
from ttkbootstrap.constants import *
my_w = ttk.Window()
my_w.geometry("800x800")
my_themes=my_w.style.theme_names() # Lit of available themes
my_w.style.theme_use('darkly') # Use or set this theme
print(my_w.style.theme_use()) # name of currently used theme
my_w.mainloop()
from tkinter.font import nametofont
default_font = nametofont("TkDefaultFont")
default_font.configure(family="Times",size=14,weight='bold')
import ttkbootstrap as ttk
from ttkbootstrap.constants import *
my_w = ttk.Window()
my_w.geometry("950x500")
#
my_themes = my_w.style.theme_names() # List of available themes
my_str = ttk.StringVar(value=my_w.style.theme_use()) # default selection of theme
r, c = 0, 0 # row=0 and column =0
for values in my_themes: # List of available themes
b = ttk.Radiobutton(
my_w, text=values, variable=my_str, value=values, command=lambda: my_upd()
) # Radio buttons with themes as values
b.grid(row=r, column=c, padx=5, pady=20)
c = c + 1 # increase column by 1
if c > 8: # One line complete so change the row and column values
r, c = r + 1, 0
c, r = 0, r + 1
for my_style in my_w.style.colors: # List of styles
b = ttk.Button(my_w, text=my_style, bootstyle=my_style)
b.grid(row=r, column=c, padx=1, pady=20)
b = ttk.Button(my_w, text=my_style, bootstyle=(my_style, OUTLINE))
b.grid(row=r + 1, column=c, padx=1, pady=20)
m1 = ttk.Meter(
subtextstyle=my_style, metersize=100, amountused=65, bootstyle=my_style
)
m1.grid(row=r + 2, column=c)
fg = ttk.Floodgauge(value=75, bootstyle=my_style)
fg.grid(row=r + 3, column=c, padx=1, pady=20)
# de=ttk.DateEntry(bootstyle=color)
# de.grid(row=r+4,column=c,padx=1,pady=20)
c = c + 1
def my_upd():
my_w.style.theme_use(my_str.get())
my_w.mainloop()
Here is a list of essential widgets, including new additions like Floodgauge, Meter, and Toast, which bring progress indicators, notifications, and more dynamic UI elements to our applications. Click on the links to explore each widget in detail.
Checkbuttons | Versatile toggle buttons that can be styled as switches or checkboxes. Ideal for user preferences, settings menus, and multi-option selections. |
ColorChooserDialog | Interactive color selection dialog for choosing colors easily. Useful for design applications, theme customization, and graphic tools. |
Tableview | Displays tabular data with sorting and styling options. Great for managing datasets, logs, and spreadsheet-like interfaces. |
Meter | Modern radial progress indicator with customizable styles. Perfect for dashboards, task completion tracking, and fitness apps. |
Floodgauge | A sleek horizontal progress indicator. Useful for showing download progress, form completion status, or time-sensitive tasks. |
DateEntry | Dropdown calendar for easy date selection. Ideal for booking systems, forms, and event schedulers. |
ToolTip | Displays helpful text in a popup on mouse hover. Useful for explaining form fields, buttons, or complex UI elements. |
Toast | Non-intrusive pop-up message alerts. Ideal for showing notifications, updates, and user feedback. |
ttkbootstrap
is an enhanced version of Tkinter that brings a modern and stylish look to GUI applications. It eliminates the need for manual styling and provides Bootstrap-like themes and widgets, making it a preferred choice for developers who want a sleek UI with minimal effort.
ttkbootstrap
Over Traditional Tkinterbtn-primary
, btn-success
, btn-danger
, etc., similar to Bootstrap.ttkbootstrap
without rewriting everything.If you want a modern UI with **minimal coding effort**, ttkbootstrap
is the perfect choice. It enhances Tkinter's functionality while maintaining compatibility, making it ideal for both new and existing projects.
Discover the full capabilities of ttkbootstrap, including widgets, themes, and styling options to enhance your Tkinter applications.
Visit Documentation27-12-2022 | |
While running the ttkbootstrap code , i am getting the colors the first time. When i am again running the code, i am not getting the colors for SUCCESS, PRIMARY and so on. |
08-01-2023 | |
Just copy the above code and try. How you are running the code again ? Are you sure you are using the loop second time ? It should work. |
17-10-2023 | |
pourquoi select_item ne fonctionne pas dans ttkbootstrap python? |