1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
import ttkbootstrap as ttk
from ttkbootstrap.constants import *
class App(object):
BUTTON_FONT_SIZE = 20
def __init__(self):
self.init_widgets()
def init_widgets(self):
#深色主题: solar superhero cyborg darkly vapor
#浅色主题:cosmo flatly journal litera lumen minty sandstone yeti
self.root = ttk.Window(themename="solar")
self.root.geometry('600x800')
self.work_state_label = ttk.Label(self.root,
text="所有支持的颜色风格",
font=("Arial", App.BUTTON_FONT_SIZE),
bootstyle= SUCCESS)
self.work_state_label.pack(pady=10)
for color in self.root.style.colors:
b = ttk.Button(self.root, text=color, bootstyle=color)
b.pack(side=TOP, padx=5, pady=5)
b1 = ttk.Button(self.root, text="Solid Button", bootstyle=SUCCESS)
b1.pack(side=TOP, padx=5, pady=10)
b2 = ttk.Button(self.root, text="Outline Button", bootstyle=(SUCCESS, OUTLINE))
b2.pack(side=TOP, padx=5, pady=10)
b3 = ttk.Button(self.root, text="Outline Button", bootstyle=(SUCCESS, OUTLINE))
b3.pack(side=TOP, padx=5, pady=10)
self.root.mainloop()
|