tkfluent 0.1.4__py3-none-any.whl → 0.1.6__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- tkflu/__init__.py +1 -0
- tkflu/__main__.py +32 -18
- tkflu/badge.py +12 -4
- tkflu/button.py +12 -3
- tkflu/bwm.py +10 -0
- tkflu/demos/demo.py +137 -0
- tkflu/demos/designer.py +19 -4
- tkflu/demos/screenshot.py +8 -0
- tkflu/demos/scroll.py +19 -0
- tkflu/designs/__init__.py +4 -1
- tkflu/designs/animation.py +2 -2
- tkflu/designs/button.py +4 -4
- tkflu/designs/design.py +20 -0
- tkflu/designs/fonts/__init__.py +16 -1
- tkflu/designs/fonts/segoe_fluent_icons.ttf +0 -0
- tkflu/designs/frame.py +2 -2
- tkflu/designs/menubar.py +2 -0
- tkflu/designs/renderer.py +19 -0
- tkflu/designs/scrollbar.py +17 -39
- tkflu/designs/text.py +5 -5
- tkflu/designs/window.py +4 -2
- tkflu/entry.py +8 -4
- tkflu/frame.py +3 -2
- tkflu/label.py +11 -8
- tkflu/listbox.py +1 -1
- tkflu/menu.py +13 -13
- tkflu/menubar.py +26 -26
- tkflu/popupmenu.py +1 -1
- tkflu/popupwindow.py +38 -14
- tkflu/scrollbar.py +347 -133
- tkflu/slider.py +113 -66
- tkflu/text.py +20 -12
- tkflu/togglebutton.py +98 -89
- tkflu/tooltip.py +6 -15
- {tkfluent-0.1.4.dist-info → tkfluent-0.1.6.dist-info}/METADATA +7 -4
- tkfluent-0.1.6.dist-info/RECORD +64 -0
- tkfluent-0.1.4.dist-info/RECORD +0 -59
- {tkfluent-0.1.4.dist-info → tkfluent-0.1.6.dist-info}/WHEEL +0 -0
tkflu/__init__.py
CHANGED
@@ -22,6 +22,7 @@ from .menu import FluMenu
|
|
22
22
|
from .menubar import FluMenuBar
|
23
23
|
from .popupmenu import FluPopupMenu, FluPopupMenuWindow
|
24
24
|
from .popupwindow import FluPopupWindow
|
25
|
+
from .scrollbar import FluScrollBar
|
25
26
|
from .slider import FluSlider
|
26
27
|
from .text import FluText
|
27
28
|
from .thememanager import FluThemeManager
|
tkflu/__main__.py
CHANGED
@@ -2,25 +2,33 @@ from tkflu import *
|
|
2
2
|
from tkinter import *
|
3
3
|
from tkinter.font import *
|
4
4
|
|
5
|
-
|
6
|
-
set_animation_steps(
|
7
|
-
set_animation_step_time(
|
5
|
+
blue_primary_color()
|
6
|
+
set_animation_steps(0)
|
7
|
+
set_animation_step_time(0)
|
8
|
+
set_renderer(0)
|
8
9
|
|
9
10
|
def togglestate():
|
10
11
|
if button1.dcget("state") == NORMAL:
|
11
12
|
button1.dconfigure(state=DISABLED)
|
12
13
|
button2.dconfigure(state=DISABLED)
|
13
14
|
entry1.dconfigure(state=DISABLED)
|
14
|
-
|
15
|
-
|
16
|
-
|
15
|
+
text1.dconfigure(state=DISABLED)
|
16
|
+
togglebutton1.dconfigure(state=DISABLED)
|
17
|
+
slider1.dconfigure(state=DISABLED)
|
17
18
|
else:
|
18
19
|
button1.dconfigure(state=NORMAL)
|
19
20
|
button2.dconfigure(state=NORMAL)
|
20
21
|
entry1.dconfigure(state=NORMAL)
|
21
|
-
|
22
|
-
|
23
|
-
|
22
|
+
text1.dconfigure(state=NORMAL)
|
23
|
+
togglebutton1.dconfigure(state=NORMAL)
|
24
|
+
slider1.dconfigure(state=NORMAL)
|
25
|
+
button1._draw()
|
26
|
+
button2._draw()
|
27
|
+
entry1._draw()
|
28
|
+
text1._draw()
|
29
|
+
togglebutton1._draw()
|
30
|
+
slider1._draw()
|
31
|
+
|
24
32
|
root = FluWindow()
|
25
33
|
#root.wincustom(way=0)
|
26
34
|
root.geometry("360x650")
|
@@ -31,38 +39,44 @@ thememanager = FluThemeManager()
|
|
31
39
|
|
32
40
|
menubar = FluMenuBar(root)
|
33
41
|
menubar.add_command(
|
34
|
-
label="FluMenu1",
|
42
|
+
label="FluMenu1", command=lambda: print("FluMenu1 -> Clicked")
|
35
43
|
)
|
36
44
|
|
37
45
|
menu1 = FluMenu()
|
38
46
|
menu1.add_command(
|
39
|
-
label="FluMenu2-1",
|
47
|
+
label="FluMenu2-1", command=lambda: print("FluMenu2-1 -> Clicked")
|
40
48
|
)
|
41
49
|
menubar.add_cascade(
|
42
|
-
label="FluMenu2",
|
50
|
+
label="FluMenu2", menu=menu1
|
43
51
|
)
|
44
52
|
|
45
53
|
menu2 = FluMenu(height=93)
|
46
54
|
menu2.add_command(
|
47
|
-
label="FluMenu3-1",
|
55
|
+
label="FluMenu3-1", command=lambda: print("FluMenu3-1 -> Clicked")
|
48
56
|
)
|
49
57
|
|
50
|
-
menu3 = FluMenu(height=
|
58
|
+
menu3 = FluMenu(height=93)
|
59
|
+
menu3.add_command(
|
60
|
+
label="FluMenu3-2-1", command=lambda: print("FluMenu3-2-1 -> Clicked")
|
61
|
+
)
|
51
62
|
menu3.add_command(
|
52
|
-
label="FluMenu3-2-
|
63
|
+
label="FluMenu3-2-2", command=lambda: print("FluMenu3-2-2 -> Clicked")
|
53
64
|
)
|
54
65
|
|
55
66
|
menu2.add_cascade(
|
56
|
-
label="FluMenu3-2",
|
67
|
+
label="FluMenu3-2", menu=menu3
|
57
68
|
)
|
58
69
|
menubar.add_cascade(
|
59
|
-
label="FluMenu3",
|
70
|
+
label="FluMenu3", menu=menu2
|
60
71
|
)
|
61
72
|
|
62
73
|
menubar.pack(fill="x")
|
63
74
|
|
64
75
|
frame = FluFrame(root)
|
65
76
|
|
77
|
+
scrollbar1 = FluScrollBar(frame)
|
78
|
+
scrollbar1.pack(fill="y", side="right", padx=5, pady=5)
|
79
|
+
|
66
80
|
badge1 = FluBadge(frame, text="FluBadge", width=60)
|
67
81
|
badge1.pack(padx=5, pady=5)
|
68
82
|
|
@@ -108,7 +122,7 @@ entry1.pack(fill="x", padx=5, pady=5)
|
|
108
122
|
text1 = FluText(frame)
|
109
123
|
text1.pack(fill="x", padx=5, pady=5)
|
110
124
|
|
111
|
-
slider1 = FluSlider(frame, value=0, max=
|
125
|
+
slider1 = FluSlider(frame, value=5, min=0, max=10, tick=True, changed=lambda: print(f"FluSlider -> Changed -> Value: {slider1.dcget('value')}"))
|
112
126
|
slider1.pack(fill="x", padx=5, pady=5)
|
113
127
|
|
114
128
|
"""listbox1 = FluListBox(frame)
|
tkflu/badge.py
CHANGED
@@ -36,7 +36,7 @@ class FluBadgeCanvas(DCanvas):
|
|
36
36
|
draw = FluBadgeDraw
|
37
37
|
|
38
38
|
def create_round_rectangle(self,
|
39
|
-
x1, y1, x2, y2, temppath=None,
|
39
|
+
x1, y1, x2, y2, temppath=None, temppath2=None,
|
40
40
|
fill="transparent", fill_opacity=1,
|
41
41
|
outline="black", outline_opacity=1, width=1
|
42
42
|
):
|
@@ -45,7 +45,10 @@ class FluBadgeCanvas(DCanvas):
|
|
45
45
|
fill=fill, fill_opacity=fill_opacity,
|
46
46
|
outline=outline, outline_opacity=outline_opacity, width=width
|
47
47
|
)
|
48
|
-
|
48
|
+
|
49
|
+
from .designs.renderer import get_renderer
|
50
|
+
|
51
|
+
self._tkimg = self.svgdraw.create_svg_image(self._img, temppath2, way=get_renderer())
|
49
52
|
return self.create_image(x1, y1, anchor="nw", image=self._tkimg)
|
50
53
|
|
51
54
|
create_roundrect = create_round_rectangle
|
@@ -130,9 +133,14 @@ class FluBadge(FluBadgeCanvas, DDrawWidget, FluToolTipBase):
|
|
130
133
|
_border_color_opacity = self.attributes.border_color_opacity
|
131
134
|
_border_width = self.attributes.border_width
|
132
135
|
_text_color = self.attributes.text_color
|
133
|
-
|
136
|
+
from .designs.renderer import get_renderer
|
137
|
+
width = self.winfo_width()
|
138
|
+
height = self.winfo_height()
|
139
|
+
if get_renderer() == 1:
|
140
|
+
width -= 1
|
141
|
+
height -= 1
|
134
142
|
self.element_border = self.create_round_rectangle(
|
135
|
-
0, 0,
|
143
|
+
0, 0, width, height, temppath=self.temppath, temppath2=self.temppath3,
|
136
144
|
fill=_back_color, fill_opacity=_back_opacity,
|
137
145
|
outline=_border_color, outline_opacity=_border_color_opacity, width=_border_width
|
138
146
|
)
|
tkflu/button.py
CHANGED
@@ -72,7 +72,7 @@ class FluButtonCanvas(DCanvas):
|
|
72
72
|
|
73
73
|
def create_round_rectangle(self,
|
74
74
|
x1: Union[int, float], y1: Union[int, float], x2: Union[int, float], y2: Union[int, float],
|
75
|
-
r1: Union[int, float], r2: Union[int, float] = None, temppath: Union[str, None] = None,
|
75
|
+
r1: Union[int, float], r2: Union[int, float] = None, temppath: Union[str, None] = None, temppath2: Union[str, None] = None,
|
76
76
|
fill: Union[str, tuple]="transparent", fill_opacity: Union[int, float] = 1,
|
77
77
|
outline: Union[str, tuple] = "black", outline2: Union[str, tuple] = "black",
|
78
78
|
outline_opacity: Union[int, float] = 1, outline2_opacity: Union[int, float] = 1,
|
@@ -105,7 +105,10 @@ class FluButtonCanvas(DCanvas):
|
|
105
105
|
outline=outline, outline2=outline2, outline_opacity=outline_opacity, outline2_opacity=outline2_opacity,
|
106
106
|
width=width,
|
107
107
|
) # 创建个svg圆角矩形图片
|
108
|
-
|
108
|
+
from .designs.renderer import get_renderer
|
109
|
+
|
110
|
+
self._tkimg = self.svgdraw.create_svg_image(path=self._img, path2=temppath2, way=get_renderer()) # 用tksvg读取svg图片
|
111
|
+
#print(self._img)
|
109
112
|
return self.create_image(x1, y1, anchor="nw", image=self._tkimg, *args, **kwargs) # 在画布上创建个以svg图片为图片的元件
|
110
113
|
|
111
114
|
create_roundrect = create_round_rectangle # 缩写
|
@@ -246,8 +249,14 @@ class FluButton(FluButtonCanvas, DDrawWidget, FluToolTipBase, FluGradient):
|
|
246
249
|
if hasattr(self, "element_border"):
|
247
250
|
self.delete(self.element_border)
|
248
251
|
|
252
|
+
from .designs.renderer import get_renderer
|
253
|
+
|
254
|
+
if get_renderer() == 1:
|
255
|
+
width -= 1
|
256
|
+
height -= 1
|
257
|
+
|
249
258
|
self.element_border = self.create_round_rectangle(
|
250
|
-
0, 0, width, height, _radius, temppath=self.temppath,
|
259
|
+
0, 0, width, height, _radius, temppath=self.temppath, temppath2=self.temppath3,
|
251
260
|
fill=_back_color, fill_opacity=_back_opacity,
|
252
261
|
outline=_border_color, outline_opacity=_border_color_opacity, outline2=_border_color2,
|
253
262
|
outline2_opacity=_border_color2_opacity,
|
tkflu/bwm.py
CHANGED
@@ -122,8 +122,18 @@ class BWm(FluGradient):
|
|
122
122
|
|
123
123
|
self.mode = mode
|
124
124
|
if mode.lower() == "dark":
|
125
|
+
try:
|
126
|
+
import pywinstyles
|
127
|
+
pywinstyles.apply_style(self, "dark")
|
128
|
+
except ModuleNotFoundError:
|
129
|
+
pass
|
125
130
|
self._dark()
|
126
131
|
else:
|
132
|
+
try:
|
133
|
+
import pywinstyles
|
134
|
+
pywinstyles.apply_style(self, "light")
|
135
|
+
except ModuleNotFoundError:
|
136
|
+
pass
|
127
137
|
self._light()
|
128
138
|
|
129
139
|
def _theme(self, mode, animation_steps: int = None, animation_step_time: int = None):
|
tkflu/demos/demo.py
ADDED
@@ -0,0 +1,137 @@
|
|
1
|
+
def run():
|
2
|
+
from tkflu import *
|
3
|
+
from tkinter import *
|
4
|
+
from tkinter.font import *
|
5
|
+
|
6
|
+
blue_primary_color()
|
7
|
+
set_animation_steps(0)
|
8
|
+
set_animation_step_time(0)
|
9
|
+
|
10
|
+
def togglestate():
|
11
|
+
if button1.dcget("state") == NORMAL:
|
12
|
+
button1.dconfigure(state=DISABLED)
|
13
|
+
button2.dconfigure(state=DISABLED)
|
14
|
+
entry1.dconfigure(state=DISABLED)
|
15
|
+
text1.dconfigure(state=DISABLED)
|
16
|
+
togglebutton1.dconfigure(state=DISABLED)
|
17
|
+
slider1.dconfigure(state=DISABLED)
|
18
|
+
else:
|
19
|
+
button1.dconfigure(state=NORMAL)
|
20
|
+
button2.dconfigure(state=NORMAL)
|
21
|
+
entry1.dconfigure(state=NORMAL)
|
22
|
+
text1.dconfigure(state=NORMAL)
|
23
|
+
togglebutton1.dconfigure(state=NORMAL)
|
24
|
+
slider1.dconfigure(state=NORMAL)
|
25
|
+
button1._draw()
|
26
|
+
button2._draw()
|
27
|
+
entry1._draw()
|
28
|
+
text1._draw()
|
29
|
+
togglebutton1._draw()
|
30
|
+
slider1._draw()
|
31
|
+
|
32
|
+
root = FluWindow()
|
33
|
+
#root.wincustom(way=0)
|
34
|
+
root.geometry("360x650")
|
35
|
+
|
36
|
+
popupmenu = FluPopupMenu()
|
37
|
+
|
38
|
+
thememanager = FluThemeManager()
|
39
|
+
|
40
|
+
menubar = FluMenuBar(root)
|
41
|
+
menubar.add_command(
|
42
|
+
label="FluMenu1", command=lambda: print("FluMenu1 -> Clicked")
|
43
|
+
)
|
44
|
+
|
45
|
+
menu1 = FluMenu()
|
46
|
+
menu1.add_command(
|
47
|
+
label="FluMenu2-1", command=lambda: print("FluMenu2-1 -> Clicked")
|
48
|
+
)
|
49
|
+
menubar.add_cascade(
|
50
|
+
label="FluMenu2", menu=menu1
|
51
|
+
)
|
52
|
+
|
53
|
+
menu2 = FluMenu(height=93)
|
54
|
+
menu2.add_command(
|
55
|
+
label="FluMenu3-1", command=lambda: print("FluMenu3-1 -> Clicked")
|
56
|
+
)
|
57
|
+
|
58
|
+
menu3 = FluMenu(height=93)
|
59
|
+
menu3.add_command(
|
60
|
+
label="FluMenu3-2-1", command=lambda: print("FluMenu3-2-1 -> Clicked")
|
61
|
+
)
|
62
|
+
menu3.add_command(
|
63
|
+
label="FluMenu3-2-2", command=lambda: print("FluMenu3-2-2 -> Clicked")
|
64
|
+
)
|
65
|
+
|
66
|
+
menu2.add_cascade(
|
67
|
+
label="FluMenu3-2", menu=menu3
|
68
|
+
)
|
69
|
+
menubar.add_cascade(
|
70
|
+
label="FluMenu3", menu=menu2
|
71
|
+
)
|
72
|
+
|
73
|
+
menubar.pack(fill="x")
|
74
|
+
|
75
|
+
frame = FluFrame(root)
|
76
|
+
|
77
|
+
scrollbar1 = FluScrollBar(frame)
|
78
|
+
scrollbar1.pack(fill="y", side="right", padx=5, pady=5)
|
79
|
+
|
80
|
+
badge1 = FluBadge(frame, text="FluBadge", width=60)
|
81
|
+
badge1.pack(padx=5, pady=5)
|
82
|
+
|
83
|
+
badge2 = FluBadge(frame, text="FluBadge (Accent)", width=120, style="accent")
|
84
|
+
badge2.pack(padx=5, pady=5)
|
85
|
+
|
86
|
+
label1 = FluLabel(frame, text="FluLabel(Hover Me)")
|
87
|
+
label1.tooltip(text="FluToolTip")
|
88
|
+
label1.pack(padx=5, pady=5)
|
89
|
+
|
90
|
+
label2 = FluLabel(frame, text="FluLabel2(Hover Me)")
|
91
|
+
label2.tooltip(text="FluToolTip2", way=1)
|
92
|
+
label2.pack(padx=5, pady=5)
|
93
|
+
|
94
|
+
button1 = FluButton(
|
95
|
+
frame, text="FluButton", command=lambda: print("FluButton -> Clicked")
|
96
|
+
)
|
97
|
+
button1.pack(fill="x", padx=5, pady=5)
|
98
|
+
|
99
|
+
button2 = FluButton(
|
100
|
+
frame, text="FluButton (Accent)", command=lambda: print("FluButton (Accent) -> Clicked"), style="accent"
|
101
|
+
)
|
102
|
+
button2.pack(fill="x", padx=5, pady=5)
|
103
|
+
|
104
|
+
togglebutton1 = FluToggleButton(
|
105
|
+
frame, text="FluToggleButton", command=lambda: print(f"FluToggleButton -> Toggled -> Checked: {togglebutton1.dcget('checked')}")
|
106
|
+
)
|
107
|
+
togglebutton1.pack(fill="x", padx=5, pady=5)
|
108
|
+
|
109
|
+
togglebutton2 = FluToggleButton(
|
110
|
+
frame, text="Toggle Theme", command=lambda: toggle_theme(togglebutton2, thememanager)
|
111
|
+
)
|
112
|
+
togglebutton2.pack(fill="x", padx=5, pady=5)
|
113
|
+
|
114
|
+
togglebutton3 = FluToggleButton(
|
115
|
+
frame, text="Toggle State", command=lambda: togglestate()
|
116
|
+
)
|
117
|
+
togglebutton3.pack(fill="x", padx=5, pady=5)
|
118
|
+
|
119
|
+
entry1 = FluEntry(frame)
|
120
|
+
entry1.pack(fill="x", padx=5, pady=5)
|
121
|
+
|
122
|
+
text1 = FluText(frame)
|
123
|
+
text1.pack(fill="x", padx=5, pady=5)
|
124
|
+
|
125
|
+
slider1 = FluSlider(frame, value=5, min=0, max=10, tick=True, changed=lambda: print(f"FluSlider -> Changed -> Value: {slider1.dcget('value')}"))
|
126
|
+
slider1.pack(fill="x", padx=5, pady=5)
|
127
|
+
|
128
|
+
"""listbox1 = FluListBox(frame)
|
129
|
+
listbox1.dconfigure()
|
130
|
+
listbox1.pack(fill="x", padx=5, pady=5)"""
|
131
|
+
|
132
|
+
frame.pack(fill="both", expand="yes", side="right", padx=15, pady=15)
|
133
|
+
#frame.update_idletasks()
|
134
|
+
|
135
|
+
#thememanager.mode("light")
|
136
|
+
|
137
|
+
root.mainloop()
|
tkflu/demos/designer.py
CHANGED
@@ -1,11 +1,12 @@
|
|
1
1
|
from tkflu import *
|
2
2
|
|
3
|
+
set_renderer(1)
|
3
4
|
set_animation_steps(10)
|
4
5
|
set_animation_step_time(10)
|
5
6
|
|
6
7
|
root = FluWindow()
|
7
8
|
root.title("tkfluent designer")
|
8
|
-
root.geometry("
|
9
|
+
root.geometry("600x300")
|
9
10
|
|
10
11
|
theme_manager = FluThemeManager(root)
|
11
12
|
|
@@ -23,11 +24,25 @@ def func1():
|
|
23
24
|
label = FluLabel(messagebox, text="This is a example for tkfluent!", width=160, height=32)
|
24
25
|
label.pack(anchor="center")
|
25
26
|
|
26
|
-
|
27
|
-
|
28
|
-
menubar.add_command(label="
|
27
|
+
style = "menu"
|
28
|
+
|
29
|
+
menubar.add_command(label="File", style=style, width=40, command=lambda: print("File -> Clicked"))
|
30
|
+
menubar.add_cascade(label="Theme Mode", style=style, width=85, menu=menu1)
|
31
|
+
menubar.add_command(label="About", style=style, width=45, command=lambda: func1())
|
29
32
|
|
30
33
|
menubar.show()
|
31
34
|
|
35
|
+
widgets = FluFrame(root, width=100)
|
36
|
+
|
37
|
+
widgets.title = FluLabel(widgets, text="Widgets", width=100)
|
38
|
+
widgets.title.pack(fill="x", side="top")
|
39
|
+
|
40
|
+
widgets.pack(fill="y", side="left", padx=10, pady=10)
|
41
|
+
|
42
|
+
windows = FluFrame(root, width=300)
|
43
|
+
windows.pack(fill="y", side="left", expand="yes", anchor="center", padx=10, pady=10)
|
44
|
+
|
45
|
+
configs = FluFrame(root, width=200)
|
46
|
+
configs.pack(fill="y", side="right", padx=10, pady=10)
|
32
47
|
|
33
48
|
root.mainloop()
|
tkflu/demos/scroll.py
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
from tkinter import *
|
2
|
+
from tkflu import *
|
3
|
+
from tkflu.designs.scrollbar import scrollbar
|
4
|
+
|
5
|
+
root = FluWindow()
|
6
|
+
|
7
|
+
frane = FluFrame(root)
|
8
|
+
frane.pack(fill="both", expand="yes", padx=10, pady=10)
|
9
|
+
|
10
|
+
scrollbar = FluScrollBar(frane, orient=VERTICAL)
|
11
|
+
scrollbar.pack(fill="y", side="right")
|
12
|
+
|
13
|
+
canvas = Canvas(frane, yscrollcommand=scrollbar.set)
|
14
|
+
canvas.pack(fill="both", expand="yes", padx=5, pady=5)
|
15
|
+
|
16
|
+
for i in range(20):
|
17
|
+
canvas.create_window(0, i * 30, anchor="nw", window=FluButton(text=f"Button {i}"))
|
18
|
+
|
19
|
+
root.mainloop()
|
tkflu/designs/__init__.py
CHANGED
@@ -1,3 +1,6 @@
|
|
1
1
|
from .design import FluDesign
|
2
2
|
from .primary_color import FluPrimaryColor, set_primary_color, get_primary_color
|
3
|
-
from .animation import FluAnimation, set_animation_steps, set_animation_step_time, get_animation_steps, get_animation_step_time
|
3
|
+
from .animation import FluAnimation, set_animation_steps, set_animation_step_time, get_animation_steps, get_animation_step_time
|
4
|
+
from .gradient import FluGradient
|
5
|
+
from .fonts import *
|
6
|
+
from .renderer import FluRenderer, set_renderer, get_renderer
|
tkflu/designs/animation.py
CHANGED
@@ -14,9 +14,9 @@ def get_animation_step_time():
|
|
14
14
|
return int(environ["tkfluent.animation_step_time"])
|
15
15
|
|
16
16
|
if "tkfluent.animation_steps" not in environ:
|
17
|
-
set_animation_steps(
|
17
|
+
set_animation_steps(0)
|
18
18
|
if "tkfluent.animation_step_time" not in environ:
|
19
|
-
set_animation_step_time(
|
19
|
+
set_animation_step_time(0)
|
20
20
|
|
21
21
|
|
22
22
|
class FluAnimation(object):
|
tkflu/designs/button.py
CHANGED
@@ -120,8 +120,8 @@ def button(mode: str, style: str, state: str):
|
|
120
120
|
}
|
121
121
|
elif state == "hover":
|
122
122
|
return {
|
123
|
-
"back_color": "#
|
124
|
-
"back_opacity":
|
123
|
+
"back_color": "#eaeaea",
|
124
|
+
"back_opacity": "1",
|
125
125
|
"border_color": "#000000",
|
126
126
|
"border_color_opacity": "0",
|
127
127
|
"border_color2": None,
|
@@ -132,8 +132,8 @@ def button(mode: str, style: str, state: str):
|
|
132
132
|
}
|
133
133
|
elif state == "pressed":
|
134
134
|
return {
|
135
|
-
"back_color": "#
|
136
|
-
"back_opacity": "
|
135
|
+
"back_color": "#ededed",
|
136
|
+
"back_opacity": "1",
|
137
137
|
"border_color": "#000000",
|
138
138
|
"border_color_opacity": "0",
|
139
139
|
"border_color2": None,
|
tkflu/designs/design.py
CHANGED
@@ -18,10 +18,30 @@ class FluDesign(object):
|
|
18
18
|
from .frame import frame
|
19
19
|
return frame(*args, **kwargs)
|
20
20
|
|
21
|
+
def label(self, *args, **kwargs):
|
22
|
+
from .label import label
|
23
|
+
return label(*args, **kwargs)
|
24
|
+
|
25
|
+
def menubar(self, *args, **kwargs):
|
26
|
+
from .menubar import menubar
|
27
|
+
return menubar(*args, **kwargs)
|
28
|
+
|
29
|
+
def scrollbar(self, *args, **kwargs):
|
30
|
+
from .scrollbar import scrollbar
|
31
|
+
return scrollbar(*args, **kwargs)
|
32
|
+
|
33
|
+
def slider(self, *args, **kwargs):
|
34
|
+
from .slider import slider
|
35
|
+
return slider(*args, **kwargs)
|
36
|
+
|
21
37
|
def text(self, *args, **kwargs):
|
22
38
|
from .text import text
|
23
39
|
return text(*args, **kwargs)
|
24
40
|
|
41
|
+
def tooltip(self, *args, **kwargs):
|
42
|
+
from .tooltip import tooltip
|
43
|
+
return tooltip(*args, **kwargs)
|
44
|
+
|
25
45
|
def window(self, *args, **kwargs):
|
26
46
|
from .window import window
|
27
47
|
return window(*args, **kwargs)
|
tkflu/designs/fonts/__init__.py
CHANGED
@@ -3,7 +3,7 @@ from os.path import abspath, dirname, join
|
|
3
3
|
path = abspath(dirname(__file__))
|
4
4
|
|
5
5
|
segoefont = join(path, "segoeui.ttf")
|
6
|
-
|
6
|
+
segoefluenticons = join(path, "segoe_fluent_icons.ttf")
|
7
7
|
|
8
8
|
def SegoeFont(size=9, weight="normal"):
|
9
9
|
from _tkinter import TclError
|
@@ -18,3 +18,18 @@ def SegoeFont(size=9, weight="normal"):
|
|
18
18
|
from tkinter.font import nametofont
|
19
19
|
font = nametofont("TkDefaultFont").configure(size=size, weight=weight)
|
20
20
|
return font
|
21
|
+
|
22
|
+
|
23
|
+
def SegoeFluentIcons(size=9, weight="normal", *args, **kwargs):
|
24
|
+
from _tkinter import TclError
|
25
|
+
try:
|
26
|
+
from tkextrafont import Font
|
27
|
+
font = Font(file=segoefluenticons, size=size, family="Segoe Fluent Icons", *args, **kwargs)
|
28
|
+
except TclError:
|
29
|
+
try:
|
30
|
+
from tkinter.font import Font
|
31
|
+
font = Font(size=size, family="Segoe Fluent Icons", *args, **kwargs)
|
32
|
+
except TclError:
|
33
|
+
from tkinter.font import nametofont
|
34
|
+
font = nametofont("TkDefaultFont").configure(size=size, weight=weight)
|
35
|
+
return font
|
Binary file
|
tkflu/designs/frame.py
CHANGED
@@ -21,7 +21,7 @@ def frame(mode, style):
|
|
21
21
|
else:
|
22
22
|
if style == "standard":
|
23
23
|
return {
|
24
|
-
"back_color": "#
|
24
|
+
"back_color": "#2b2b2b",
|
25
25
|
"border_color": "#000000",
|
26
26
|
"border_color_opacity": 0.100000,
|
27
27
|
"border_width": 2,
|
@@ -29,7 +29,7 @@ def frame(mode, style):
|
|
29
29
|
}
|
30
30
|
else:
|
31
31
|
return {
|
32
|
-
"back_color": "#
|
32
|
+
"back_color": "#2b2b2b",
|
33
33
|
"border_color": "#000000",
|
34
34
|
"border_color_opacity": 0.100000,
|
35
35
|
"border_width": 2,
|
tkflu/designs/menubar.py
CHANGED
@@ -0,0 +1,19 @@
|
|
1
|
+
from os import environ
|
2
|
+
|
3
|
+
|
4
|
+
def set_renderer(way: int):
|
5
|
+
environ["tkfluent.renderer"] = str(way)
|
6
|
+
|
7
|
+
def get_renderer():
|
8
|
+
return int(environ["tkfluent.renderer"])
|
9
|
+
|
10
|
+
if "tkfluent.renderer" not in environ:
|
11
|
+
set_renderer(0)
|
12
|
+
|
13
|
+
|
14
|
+
class FluRenderer(object):
|
15
|
+
def renderer(self, way: int = None):
|
16
|
+
if way:
|
17
|
+
environ["tkfluent.renderer"] = str(way)
|
18
|
+
else:
|
19
|
+
return int(environ["tkfluent.renderer"])
|
tkflu/designs/scrollbar.py
CHANGED
@@ -1,56 +1,34 @@
|
|
1
|
-
def scrollbar(mode
|
1
|
+
def scrollbar(mode):
|
2
2
|
"""滚动栏设计配置"""
|
3
3
|
if mode.lower() == "dark":
|
4
4
|
return {
|
5
5
|
"rest": {
|
6
|
-
"
|
7
|
-
"
|
8
|
-
"thumb_color": "#606060",
|
9
|
-
"thumb_opacity": 0.8
|
6
|
+
"thumb_color": "#9a9a9a",
|
7
|
+
"radius": 2,
|
10
8
|
},
|
11
|
-
"
|
12
|
-
"track_color": "#
|
13
|
-
"
|
14
|
-
"
|
15
|
-
"thumb_opacity": 1.0
|
16
|
-
},
|
17
|
-
"pressed": {
|
18
|
-
"track_color": "#202020",
|
19
|
-
"track_opacity": 0.9,
|
20
|
-
"thumb_color": "#A0A0A0",
|
21
|
-
"thumb_opacity": 1.0
|
9
|
+
"expand": {
|
10
|
+
"track_color": "#2b2b2b",
|
11
|
+
"thumb_color": "#9f9f9f",
|
12
|
+
"radius": 4,
|
22
13
|
},
|
23
14
|
"disabled": {
|
24
|
-
"
|
25
|
-
"
|
26
|
-
"thumb_color": "#404040",
|
27
|
-
"thumb_opacity": 0.5
|
15
|
+
"thumb_color": "#515151",
|
16
|
+
"radius": 2,
|
28
17
|
}
|
29
18
|
}
|
30
19
|
else: # light mode
|
31
20
|
return {
|
32
21
|
"rest": {
|
33
|
-
"
|
34
|
-
"
|
35
|
-
"thumb_color": "#C0C0C0",
|
36
|
-
"thumb_opacity": 0.8
|
37
|
-
},
|
38
|
-
"hover": {
|
39
|
-
"track_color": "#F0F0F0",
|
40
|
-
"track_opacity": 0.7,
|
41
|
-
"thumb_color": "#A0A0A0",
|
42
|
-
"thumb_opacity": 1.0
|
22
|
+
"thumb_color": "#868686",
|
23
|
+
"radius": 2,
|
43
24
|
},
|
44
|
-
"
|
45
|
-
"track_color": "#
|
46
|
-
"
|
47
|
-
"
|
48
|
-
"thumb_opacity": 1.0
|
25
|
+
"expand": {
|
26
|
+
"track_color": "#f8f8f8",
|
27
|
+
"thumb_color": "#898989",
|
28
|
+
"radius": 4,
|
49
29
|
},
|
50
30
|
"disabled": {
|
51
|
-
"
|
52
|
-
"
|
53
|
-
"thumb_color": "#E0E0E0",
|
54
|
-
"thumb_opacity": 0.5
|
31
|
+
"thumb_color": "#9f9f9f",
|
32
|
+
"radius": 2,
|
55
33
|
}
|
56
34
|
}
|