tkfluent 0.0.4__tar.gz → 0.0.6__tar.gz

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.
Files changed (58) hide show
  1. {tkfluent-0.0.4 → tkfluent-0.0.6}/PKG-INFO +4 -2
  2. tkfluent-0.0.6/README.md +3 -0
  3. {tkfluent-0.0.4 → tkfluent-0.0.6}/pyproject.toml +2 -2
  4. {tkfluent-0.0.4 → tkfluent-0.0.6}/tkflu/__init__.py +2 -1
  5. {tkfluent-0.0.4 → tkfluent-0.0.6}/tkflu/__main__.py +12 -11
  6. {tkfluent-0.0.4 → tkfluent-0.0.6}/tkflu/badge.py +41 -32
  7. tkfluent-0.0.6/tkflu/button.py +265 -0
  8. {tkfluent-0.0.4 → tkfluent-0.0.6}/tkflu/bwm.py +43 -26
  9. tkfluent-0.0.6/tkflu/defs.py +16 -0
  10. tkfluent-0.0.6/tkflu/designs/__init__.py +2 -0
  11. tkfluent-0.0.6/tkflu/designs/__pycache__/__init__.cpython-311.pyc +0 -0
  12. tkfluent-0.0.6/tkflu/designs/__pycache__/badge.cpython-311.pyc +0 -0
  13. tkfluent-0.0.6/tkflu/designs/__pycache__/button.cpython-311.pyc +0 -0
  14. tkfluent-0.0.6/tkflu/designs/__pycache__/design.cpython-311.pyc +0 -0
  15. tkfluent-0.0.6/tkflu/designs/__pycache__/entry.cpython-311.pyc +0 -0
  16. tkfluent-0.0.6/tkflu/designs/__pycache__/frame.cpython-311.pyc +0 -0
  17. tkfluent-0.0.6/tkflu/designs/__pycache__/primary_color.cpython-311.pyc +0 -0
  18. tkfluent-0.0.6/tkflu/designs/__pycache__/text.cpython-311.pyc +0 -0
  19. tkfluent-0.0.6/tkflu/designs/__pycache__/window.cpython-311.pyc +0 -0
  20. tkfluent-0.0.6/tkflu/designs/badge.py +44 -0
  21. tkfluent-0.0.6/tkflu/designs/button.py +304 -0
  22. tkfluent-0.0.6/tkflu/designs/design.py +27 -0
  23. tkfluent-0.0.6/tkflu/designs/entry.py +164 -0
  24. tkfluent-0.0.6/tkflu/designs/fonts/__init__.py +20 -0
  25. tkfluent-0.0.6/tkflu/designs/fonts/__pycache__/__init__.cpython-311.pyc +0 -0
  26. tkfluent-0.0.6/tkflu/designs/fonts/segoeui.ttf +0 -0
  27. tkfluent-0.0.6/tkflu/designs/frame.py +37 -0
  28. tkfluent-0.0.6/tkflu/designs/primary_color.py +25 -0
  29. tkfluent-0.0.6/tkflu/designs/text.py +164 -0
  30. tkfluent-0.0.6/tkflu/designs/window.py +21 -0
  31. tkfluent-0.0.6/tkflu/entry.py +296 -0
  32. {tkfluent-0.0.4 → tkfluent-0.0.6}/tkflu/frame.py +84 -43
  33. {tkfluent-0.0.4 → tkfluent-0.0.6}/tkflu/label.py +2 -3
  34. {tkfluent-0.0.4 → tkfluent-0.0.6}/tkflu/menu.py +2 -1
  35. {tkfluent-0.0.4 → tkfluent-0.0.6}/tkflu/popupwindow.py +1 -1
  36. tkfluent-0.0.6/tkflu/text.py +299 -0
  37. tkfluent-0.0.6/tkflu/togglebutton.py +384 -0
  38. tkfluent-0.0.4/README.md +0 -1
  39. tkfluent-0.0.4/tkflu/button.py +0 -482
  40. tkfluent-0.0.4/tkflu/entry.py +0 -232
  41. tkfluent-0.0.4/tkflu/text.py +0 -228
  42. tkfluent-0.0.4/tkflu/togglebutton.py +0 -299
  43. tkfluent-0.0.4/tkflu/winico.py +0 -25
  44. {tkfluent-0.0.4 → tkfluent-0.0.6}/tkflu/checkbox.py +0 -0
  45. {tkfluent-0.0.4 → tkfluent-0.0.6}/tkflu/constants.py +0 -0
  46. {tkfluent-0.0.4 → tkfluent-0.0.6}/tkflu/customwindow.py +0 -0
  47. {tkfluent-0.0.4 → tkfluent-0.0.6}/tkflu/customwindow2.py +0 -0
  48. {tkfluent-0.0.4 → tkfluent-0.0.6}/tkflu/icons.py +0 -0
  49. {tkfluent-0.0.4 → tkfluent-0.0.6}/tkflu/image.py +0 -0
  50. {tkfluent-0.0.4 → tkfluent-0.0.6}/tkflu/listbox.py +0 -0
  51. {tkfluent-0.0.4 → tkfluent-0.0.6}/tkflu/litenav.py +0 -0
  52. {tkfluent-0.0.4 → tkfluent-0.0.6}/tkflu/menubar.py +0 -0
  53. {tkfluent-0.0.4 → tkfluent-0.0.6}/tkflu/popupmenu.py +0 -0
  54. {tkfluent-0.0.4 → tkfluent-0.0.6}/tkflu/scrollbar.py +0 -0
  55. {tkfluent-0.0.4 → tkfluent-0.0.6}/tkflu/thememanager.py +0 -0
  56. {tkfluent-0.0.4 → tkfluent-0.0.6}/tkflu/tooltip.py +0 -0
  57. {tkfluent-0.0.4 → tkfluent-0.0.6}/tkflu/toplevel.py +0 -0
  58. {tkfluent-0.0.4 → tkfluent-0.0.6}/tkflu/window.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: tkfluent
3
- Version: 0.0.4
3
+ Version: 0.0.6
4
4
  Summary: Fluent Design for Tkinter
5
5
  Author: XiangQinxi
6
6
  Author-email: xiangqinxi@outlook.com
@@ -15,10 +15,12 @@ Classifier: Programming Language :: Python :: 3.12
15
15
  Requires-Dist: easydict (>=1.13,<2.0)
16
16
  Requires-Dist: pillow (>=10.2.0,<11.0.0)
17
17
  Requires-Dist: svgwrite (>=1.4.3,<2.0.0)
18
- Requires-Dist: tkdeft (>=0.0.7,<0.0.8)
18
+ Requires-Dist: tkdeft (>=0.0.9,<0.0.10)
19
19
  Requires-Dist: tkextrafont (>=0.6.3,<0.7.0)
20
20
  Requires-Dist: tksvg (>=0.7.4,<0.8.0)
21
21
  Project-URL: Documentation, https://tkfluent.netlify.app
22
22
  Description-Content-Type: text/markdown
23
23
 
24
24
  # tkfluent
25
+
26
+ `tkinter`现代化组件库。设计来于`Fluent` `WinUI3` 设计
@@ -0,0 +1,3 @@
1
+ # tkfluent
2
+
3
+ `tkinter`现代化组件库。设计来于`Fluent` `WinUI3` 设计
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "tkfluent"
3
- version = "0.0.4"
3
+ version = "0.0.6"
4
4
  description = "Fluent Design for Tkinter"
5
5
  authors = ["XiangQinxi <xiangqinxi@outlook.com>"]
6
6
  readme = "README.md"
@@ -15,7 +15,7 @@ tksvg = "^0.7.4"
15
15
  tkextrafont = "^0.6.3"
16
16
  svgwrite = "^1.4.3"
17
17
  pillow = "^10.2.0"
18
- tkdeft = "^0.0.7"
18
+ tkdeft = "^0.0.9"
19
19
  easydict = "^1.13"
20
20
 
21
21
  [build-system]
@@ -10,6 +10,7 @@ Fluent设计的tkinter组件库(模板)
10
10
  from .badge import FluBadge
11
11
  from .button import FluButton
12
12
  from .constants import *
13
+ from .defs import *
13
14
  from .entry import FluEntry
14
15
  from .frame import FluFrame
15
16
  from .label import FluLabel
@@ -23,8 +24,8 @@ from .togglebutton import FluToggleButton
23
24
  from .tooltip import FluToolTip
24
25
  from .toplevel import FluToplevel
25
26
  from .window import FluWindow
26
- #from .winico import FluWinico
27
27
 
28
+ from .designs import *
28
29
 
29
30
  FluChip = FluBadge
30
31
  FluPushButton = FluButton
@@ -2,6 +2,8 @@ from tkflu import *
2
2
  from tkinter import *
3
3
  from tkinter.font import *
4
4
 
5
+ orange_primary_color()
6
+
5
7
  root = FluWindow()
6
8
  #root.wincustom(way=0)
7
9
  root.wm_geometry("360x500")
@@ -40,7 +42,7 @@ menubar.add_cascade(
40
42
  label="FluMenu3", width=80, menu=menu2
41
43
  )
42
44
 
43
- menubar.pack(fill="x", )
45
+ menubar.pack(fill="x")
44
46
 
45
47
  frame = FluFrame(root)
46
48
 
@@ -60,23 +62,22 @@ button2 = FluButton(
60
62
  )
61
63
  button2.pack(fill="x", padx=5, pady=5)
62
64
 
63
-
64
- def toggle1():
65
- print(f"FluToggleButton -> Toggled -> Checked: {togglebutton1.dcget('checked')}")
66
- if togglebutton1.dcget('checked'):
67
- thememanager.mode("dark")
68
- else:
69
- thememanager.mode("light")
70
-
71
-
72
65
  togglebutton1 = FluToggleButton(
73
- frame, text="FluToggleButton", command=toggle1
66
+ frame, text="FluToggleButton", command=lambda: print(f"FluToggleButton -> Toggled -> Checked: {togglebutton1.dcget('checked')}")
74
67
  )
75
68
  togglebutton1.pack(fill="x", padx=5, pady=5)
76
69
 
70
+ togglebutton2 = FluToggleButton(
71
+ frame, text="Toggle Theme", command=lambda: toggle_theme(togglebutton2, thememanager)
72
+ )
73
+ togglebutton2.pack(fill="x", padx=5, pady=5)
74
+
77
75
  entry1 = FluEntry(frame)
78
76
  entry1.pack(fill="x", padx=5, pady=5)
79
77
 
78
+ entry2 = FluEntry(frame, height=50)
79
+ entry2.pack(fill="x", padx=5, pady=5)
80
+
80
81
  text1 = FluText(frame)
81
82
  text1.pack(fill="x", padx=5, pady=5)
82
83
 
@@ -2,18 +2,30 @@ from tkdeft.windows.draw import DSvgDraw
2
2
  from tkdeft.windows.canvas import DCanvas
3
3
  from tkdeft.windows.drawwidget import DDrawWidget
4
4
 
5
+ from .designs.badge import badge
6
+
5
7
 
6
8
  class FluBadgeDraw(DSvgDraw):
7
9
  def create_roundrect(self,
8
10
  x1, y1, x2, y2, temppath=None,
9
- fill="transparent", outline="black", width=1
11
+ fill="transparent", fill_opacity=1,
12
+ outline="black", outline_opacity=1, width=1
10
13
  ):
11
14
  drawing = self.create_drawing(x2 - x1, y2 - y1, temppath=temppath)
12
15
  drawing[1].add(
13
16
  drawing[1].rect(
14
17
  (x1, y1), (x2 - x1, y2 - y1), 20, 25,
15
- fill=fill, stroke_width=width,
16
- stroke=outline,
18
+ id=".Badge", transform="translate(0.500000 0.500000)",
19
+ fill=fill, fill_opacity=fill_opacity,
20
+ stroke=outline, stroke_opacity=outline_opacity, stroke_width=width,
21
+ )
22
+ )
23
+ drawing[1].add(
24
+ drawing[1].rect(
25
+ (x1, y1), (x2 - x1, y2 - y1), 20, 25,
26
+ id=".Badge", transform="translate(0.500000 0.500000)",
27
+ fill="white", fill_opacity=0,
28
+ stroke=outline, stroke_opacity=outline_opacity, stroke_width=width,
17
29
  )
18
30
  )
19
31
  drawing[1].save()
@@ -25,11 +37,13 @@ class FluBadgeCanvas(DCanvas):
25
37
 
26
38
  def create_round_rectangle(self,
27
39
  x1, y1, x2, y2, temppath=None,
28
- fill="transparent", outline="black", width=1
40
+ fill="transparent", fill_opacity=1,
41
+ outline="black", outline_opacity=1, width=1
29
42
  ):
30
43
  self._img = self.svgdraw.create_roundrect(
31
44
  x1, y1, x2, y2, temppath=temppath,
32
- fill=fill, outline=outline, width=width
45
+ fill=fill, fill_opacity=fill_opacity,
46
+ outline=outline, outline_opacity=outline_opacity, width=width
33
47
  )
34
48
  self._tkimg = self.svgdraw.create_tksvg_image(self._img)
35
49
  return self.create_image(x1, y1, anchor="nw", image=self._tkimg)
@@ -72,9 +86,8 @@ class FluBadge(FluBadgeCanvas, DDrawWidget):
72
86
 
73
87
  self.bind("<<Clicked>>", lambda event=None: self.focus_set(), add="+")
74
88
 
75
- if font is None:
76
- from tkdeft.utility.fonts import SegoeFont
77
- self.attributes.font = SegoeFont()
89
+ from .defs import set_default_font
90
+ set_default_font(font, self.attributes)
78
91
 
79
92
  def _init(self, mode, style):
80
93
  from easydict import EasyDict
@@ -86,7 +99,9 @@ class FluBadge(FluBadgeCanvas, DDrawWidget):
86
99
  "font": None,
87
100
 
88
101
  "back_color": None,
102
+ "back_opacity": None,
89
103
  "border_color": None,
104
+ "border_color_opacity": None,
90
105
  "border_width": None,
91
106
  "text_color": None
92
107
  }
@@ -107,13 +122,16 @@ class FluBadge(FluBadgeCanvas, DDrawWidget):
107
122
  self.delete("all")
108
123
 
109
124
  _back_color = self.attributes.back_color
125
+ _back_opacity = self.attributes.back_opacity
110
126
  _border_color = self.attributes.border_color
127
+ _border_color_opacity = self.attributes.border_color_opacity
111
128
  _border_width = self.attributes.border_width
112
129
  _text_color = self.attributes.text_color
113
130
 
114
131
  self.element_border = self.create_round_rectangle(
115
132
  0, 0, self.winfo_width(), self.winfo_height(), temppath=self.temppath,
116
- fill=_back_color, outline=_border_color, width=_border_width
133
+ fill=_back_color, fill_opacity=_back_opacity,
134
+ outline=_border_color, outline_opacity=_border_color_opacity, width=_border_width
117
135
  )
118
136
 
119
137
  self.element_text = self.create_text(
@@ -137,34 +155,25 @@ class FluBadge(FluBadgeCanvas, DDrawWidget):
137
155
  else:
138
156
  self._light()
139
157
 
140
- def _light(self):
158
+ def _theme(self, mode, style):
159
+ n = badge(mode, style)
141
160
  self.dconfigure(
142
- back_color="#f9f9f9",
143
- border_color="#f0f0f0",
144
- border_width=1,
145
- text_color="#191919",
161
+ back_color=n["back_color"],
162
+ back_opacity=n["back_opacity"],
163
+ border_color=n["border_color"],
164
+ border_color_opacity=n["border_color_opacity"],
165
+ border_width=n["border_width"],
166
+ text_color=n["text_color"],
146
167
  )
147
168
 
169
+ def _light(self):
170
+ self._theme("light", "standard")
171
+
148
172
  def _light_accent(self):
149
- self.dconfigure(
150
- back_color="#005fb8",
151
- border_color="#005fb8",
152
- border_width=1,
153
- text_color="#ffffff",
154
- )
173
+ self._theme("light", "accent")
155
174
 
156
175
  def _dark(self):
157
- self.dconfigure(
158
- back_color="#242424",
159
- border_color="#242424",
160
- border_width=1,
161
- text_color="#ffffff",
162
- )
176
+ self._theme("dark", "standard")
163
177
 
164
178
  def _dark_accent(self):
165
- self.dconfigure(
166
- back_color="#60cdff",
167
- border_color="#60cdff",
168
- border_width=1,
169
- text_color="#000000",
170
- )
179
+ self._theme("dark", "accent")
@@ -0,0 +1,265 @@
1
+ from tkdeft.windows.draw import DSvgDraw
2
+ from tkdeft.windows.canvas import DCanvas
3
+ from tkdeft.windows.drawwidget import DDrawWidget
4
+
5
+ from .designs.button import button
6
+
7
+
8
+ class FluButtonDraw(DSvgDraw):
9
+ def create_roundrect(self,
10
+ x1, y1, x2, y2, radius, radiusy=None, temppath=None,
11
+ fill="transparent", fill_opacity=1,
12
+ outline="black", outline2=None, outline_opacity=1, outline2_opacity=1, width=1,
13
+ ):
14
+ if radiusy:
15
+ _rx = radius
16
+ _ry = radiusy
17
+ else:
18
+ _rx, _ry = radius, radius
19
+ drawing = self.create_drawing(x2 - x1, y2 - y1, temppath=temppath)
20
+ if outline2:
21
+ border = drawing[1].linearGradient(start=(x1, y1), end=(x1, y2), id="DButton.Border",
22
+ gradientUnits="userSpaceOnUse")
23
+ border.add_stop_color("0.9", outline, outline_opacity)
24
+ border.add_stop_color("1", outline2, outline2_opacity)
25
+ drawing[1].defs.add(border)
26
+ stroke = f"url(#{border.get_id()})"
27
+ stroke_opacity = 1
28
+ else:
29
+ stroke = outline
30
+ stroke_opacity = outline_opacity
31
+ drawing[1].add(
32
+ drawing[1].rect(
33
+ (x1, y1), (x2 - x1, y2 - y1), _rx, _ry,
34
+ fill=fill, fill_opacity=fill_opacity,
35
+ stroke=stroke, stroke_width=width, stroke_opacity=stroke_opacity,
36
+ transform="translate(0.500000 0.500000)"
37
+ )
38
+ )
39
+ drawing[1].save()
40
+ return drawing[0]
41
+
42
+
43
+ class FluButtonCanvas(DCanvas):
44
+ draw = FluButtonDraw
45
+
46
+ def create_round_rectangle(self,
47
+ x1, y1, x2, y2, r1, r2=None, temppath=None,
48
+ fill="transparent", fill_opacity=1,
49
+ outline="black", outline2="black", outline_opacity=1, outline2_opacity=1,
50
+ width=1,
51
+ ):
52
+ self._img = self.svgdraw.create_roundrect(
53
+ x1, y1, x2, y2, r1, r2, temppath=temppath,
54
+ fill=fill, fill_opacity=fill_opacity,
55
+ outline=outline, outline2=outline2, outline_opacity=outline_opacity, outline2_opacity=outline2_opacity,
56
+ width=width,
57
+ )
58
+ self._tkimg = self.svgdraw.create_tksvg_image(self._img)
59
+ return self.create_image(x1, y1, anchor="nw", image=self._tkimg)
60
+
61
+ create_roundrect = create_round_rectangle
62
+
63
+
64
+ class FluButton(FluButtonCanvas, DDrawWidget):
65
+ def __init__(self, *args,
66
+ text="",
67
+ width=120,
68
+ height=32,
69
+ command=None,
70
+ font=None,
71
+ mode="light",
72
+ style="standard",
73
+ state="normal",
74
+ **kwargs):
75
+ self._init(mode, style)
76
+
77
+ super().__init__(*args, width=width, height=height, **kwargs)
78
+
79
+ if command is None:
80
+ def empty(): pass
81
+
82
+ command = empty
83
+
84
+ self.dconfigure(
85
+ text=text,
86
+ command=command,
87
+ state=state,
88
+ )
89
+
90
+ self.bind("<<Clicked>>", lambda event=None: self.focus_set(), add="+")
91
+ self.bind("<<Clicked>>", lambda event=None: self.attributes.command(), add="+")
92
+
93
+ self.bind("<Return>", lambda event=None: self.attributes.command(), add="+") # 可以使用回车键模拟点击
94
+
95
+ from .defs import set_default_font
96
+ set_default_font(font, self.attributes)
97
+
98
+ def _init(self, mode, style):
99
+
100
+ from easydict import EasyDict
101
+
102
+ self.attributes = EasyDict(
103
+ {
104
+ "text": "",
105
+ "command": None,
106
+ "font": None,
107
+ "state": "normal",
108
+
109
+ "rest": {},
110
+ "hover": {},
111
+ "pressed": {},
112
+ "disabled": {}
113
+ }
114
+ )
115
+
116
+ self.theme(mode=mode, style=style)
117
+
118
+ def _draw(self, event=None):
119
+ super()._draw(event)
120
+
121
+ width = self.winfo_width()
122
+ height = self.winfo_height()
123
+
124
+ self.delete("all")
125
+
126
+ state = self.dcget("state")
127
+
128
+ _dict = None
129
+
130
+ if state == "normal":
131
+ if self.enter:
132
+ if self.button1:
133
+ _dict = self.attributes.pressed
134
+ else:
135
+ _dict = self.attributes.hover
136
+ else:
137
+ _dict = self.attributes.rest
138
+ else:
139
+ _dict = self.attributes.disabled
140
+
141
+ _back_color = _dict.back_color
142
+ _back_opacity = _dict.back_opacity
143
+ _border_color = _dict.border_color
144
+ _border_color_opacity = _dict.border_color_opacity
145
+ _border_color2 = _dict.border_color2
146
+ _border_color2_opacity = _dict.border_color2_opacity
147
+ _border_width = _dict.border_width
148
+ _radius = _dict.radius
149
+ _text_color = _dict.text_color
150
+
151
+ self.element_border = self.create_round_rectangle(
152
+ 0, 0, width, height, _radius, temppath=self.temppath,
153
+ fill=_back_color, fill_opacity=_back_opacity,
154
+ outline=_border_color, outline_opacity=_border_color_opacity, outline2=_border_color2,
155
+ outline2_opacity=_border_color2_opacity,
156
+ width=_border_width,
157
+ )
158
+
159
+ self.element_text = self.create_text(
160
+ self.winfo_width() / 2, self.winfo_height() / 2, anchor="center",
161
+ fill=_text_color, text=self.attributes.text, font=self.attributes.font
162
+ )
163
+
164
+ def theme(self, mode=None, style=None):
165
+ if mode:
166
+ self.mode = mode
167
+ if style:
168
+ self.style = style
169
+ if self.mode.lower() == "dark":
170
+ if self.style.lower() == "accent":
171
+ self._dark_accent()
172
+ elif self.style.lower() == "menu":
173
+ self._dark_menu()
174
+ else:
175
+ self._dark()
176
+ else:
177
+ if self.style.lower() == "accent":
178
+ self._light_accent()
179
+ elif self.style.lower() == "menu":
180
+ self._light_menu()
181
+ else:
182
+ self._light()
183
+
184
+ def _theme(self, mode, style):
185
+ r = button(mode, style, "rest")
186
+ h = button(mode, style, "hover")
187
+ p = button(mode, style, "pressed")
188
+ d = button(mode, style, "disabled")
189
+ self.dconfigure(
190
+ rest={
191
+ "back_color": r["back_color"],
192
+ "back_opacity": r["back_opacity"],
193
+ "border_color": r["border_color"],
194
+ "border_color_opacity": r["border_color_opacity"],
195
+ "border_color2": r["border_color2"],
196
+ "border_color2_opacity": r["border_color2_opacity"],
197
+ "border_width": r["border_width"],
198
+ "radius": r["radius"],
199
+ "text_color": r["text_color"],
200
+ },
201
+ hover={
202
+ "back_color": h["back_color"],
203
+ "back_opacity": h["back_opacity"],
204
+ "border_color": h["border_color"],
205
+ "border_color_opacity": h["border_color_opacity"],
206
+ "border_color2": h["border_color2"],
207
+ "border_color2_opacity": h["border_color2_opacity"],
208
+ "border_width": h["border_width"],
209
+ "radius": h["radius"],
210
+ "text_color": h["text_color"],
211
+ },
212
+ pressed={
213
+ "back_color": p["back_color"],
214
+ "back_opacity": p["back_opacity"],
215
+ "border_color": p["border_color"],
216
+ "border_color_opacity": p["border_color_opacity"],
217
+ "border_color2": p["border_color2"],
218
+ "border_color2_opacity": p["border_color2_opacity"],
219
+ "border_width": p["border_width"],
220
+ "radius": p["radius"],
221
+ "text_color": p["text_color"],
222
+ },
223
+ disabled={
224
+ "back_color": d["back_color"],
225
+ "back_opacity": d["back_opacity"],
226
+ "border_color": d["border_color"],
227
+ "border_color_opacity": d["border_color_opacity"],
228
+ "border_color2": d["border_color2"],
229
+ "border_color2_opacity": d["border_color2_opacity"],
230
+ "border_width": d["border_width"],
231
+ "radius": d["radius"],
232
+ "text_color": d["text_color"],
233
+ }
234
+ )
235
+
236
+ def _light(self):
237
+ self._theme("light", "standard")
238
+
239
+ def _light_menu(self):
240
+ self._theme("light", "menu")
241
+
242
+ def _light_accent(self):
243
+ self._theme("light", "accent")
244
+
245
+ def _dark(self):
246
+ self._theme("dark", "standard")
247
+
248
+ def _dark_menu(self):
249
+ self._theme("dark", "menu")
250
+
251
+ def _dark_accent(self):
252
+ self._theme("dark", "accent")
253
+
254
+ def invoke(self):
255
+ self.attributes.command()
256
+
257
+ def _event_off_button1(self, event=None):
258
+ self.button1 = False
259
+
260
+ self._draw(event)
261
+
262
+ if self.enter:
263
+ # self.focus_set()
264
+ if self.dcget("state") == "normal":
265
+ self.event_generate("<<Clicked>>")
@@ -18,29 +18,49 @@ class BWm(object):
18
18
  if hasattr(self, "closebutton"):
19
19
  self.closebutton.dconfigure(
20
20
  rest={
21
- "back_color": self.titlebar.cget("background"),
22
- "border_color": "#f0f0f0",
23
- "border_color2": "#d6d6d6",
24
- "border_width": 0,
21
+ "back_color": "#ffffff",
22
+ "back_opacity": 0,
23
+ "border_color": "#000000",
24
+ "border_color_opacity": 0,
25
+ "border_color2": None,
26
+ "border_color2_opacity": None,
27
+ "border_width": 1,
25
28
  "radius": 0,
26
29
  "text_color": self.attributes.closebutton.text_color,
27
30
  },
28
31
  hover={
29
32
  "back_color": self.attributes.closebutton.back_color,
30
- "border_color": "#f0f0f0",
31
- "border_color2": "#d6d6d6",
32
- "border_width": 0,
33
+ "back_opacity": 1,
34
+ "border_color": "#000000",
35
+ "border_color_opacity": 0,
36
+ "border_color2": None,
37
+ "border_color2_opacity": None,
38
+ "border_width": 1,
33
39
  "radius": 0,
34
40
  "text_color": self.attributes.closebutton.text_hover_color,
35
41
  },
36
42
  pressed={
37
43
  "back_color": self.attributes.closebutton.back_color,
38
- "border_color": "#f0f0f0",
39
- "border_color2": "#f0f0f0",
40
- "border_width": 0,
44
+ "back_opacity": 0.7,
45
+ "border_color": "#000000",
46
+ "border_color_opacity": 0,
47
+ "border_color2": None,
48
+ "border_color2_opacity": None,
49
+ "border_width": 1,
41
50
  "radius": 0,
42
51
  "text_color": self.attributes.closebutton.text_hover_color,
43
- }
52
+ },
53
+ disabled={
54
+ "back_color": "#ffffff",
55
+ "back_opacity": 0.3,
56
+ "border_color": "#000000",
57
+ "border_color_opacity": 0,
58
+ "border_color2": None,
59
+ "border_color2_opacity": None,
60
+ "border_width": 1,
61
+ "radius": 0,
62
+ "text_color": "#a2a2a2",
63
+ },
44
64
  )
45
65
  self.closebutton._draw()
46
66
 
@@ -103,27 +123,24 @@ class BWm(object):
103
123
  else:
104
124
  self._light()
105
125
 
106
- def _light(self):
126
+ def _theme(self, mode):
127
+ from .designs.window import window
128
+ n = window(mode)
107
129
  self.dconfigure(
108
- back_color="#ffffff",
109
- text_color="#000000",
130
+ back_color=n["back_color"],
131
+ text_color=n["text_color"],
110
132
  closebutton={
111
- "back_color": "red",
112
- "text_color": "#000000",
113
- "text_hover_color": "#ffffff"
133
+ "back_color": n["closebutton"]["back_color"],
134
+ "text_color": n["closebutton"]["text_color"],
135
+ "text_hover_color": n["closebutton"]["text_hover_color"]
114
136
  }
115
137
  )
116
138
 
139
+ def _light(self):
140
+ self._theme("light")
141
+
117
142
  def _dark(self):
118
- self.dconfigure(
119
- back_color="#202020",
120
- text_color="#ffffff",
121
- closebutton={
122
- "back_color": "red",
123
- "text_color": "#ffffff",
124
- "text_hover_color": "#000000"
125
- }
126
- )
143
+ self._theme("dark")
127
144
 
128
145
  def wincustom(self, wait=200, way=1):
129
146
 
@@ -0,0 +1,16 @@
1
+ def toggle_theme(toggle_button, thememanager):
2
+ if toggle_button.dcget('checked'):
3
+ thememanager.mode("dark")
4
+ else:
5
+ thememanager.mode("light")
6
+
7
+
8
+ def set_default_font(font, attributes):
9
+ if font is None:
10
+ from .designs.fonts import SegoeFont
11
+ attributes.font = SegoeFont()
12
+
13
+
14
+ def orange_primary_color():
15
+ from .designs.primary_color import set_primary_color
16
+ set_primary_color(("#c53201", "#fe7e34"))
@@ -0,0 +1,2 @@
1
+ from .design import FluDesign
2
+ from .primary_color import FluPrimaryColor, set_primary_color, get_primary_color