环境安装
pip install ttkbootstrap
示例1:基础主题切换器
import ttkbootstrap as ttk
from ttkbootstrap.constants import *
def create_theme_switcher():
root = ttk.Window(title="主题切换器", themename="cosmo")
def change_theme():
selected = theme_var.get()
root.style.theme_use(selected)
theme_var = ttk.StringVar(value="cosmo")
themes = root.style.theme_names() # 获取所有可用主题
frame = ttk.Frame(root, padding=10)
frame.pack(fill=BOTH, expand=YES)