tkfluent 0.1.5__tar.gz → 0.1.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 (65) hide show
  1. {tkfluent-0.1.5 → tkfluent-0.1.6}/PKG-INFO +2 -2
  2. {tkfluent-0.1.5 → tkfluent-0.1.6}/pyproject.toml +4 -3
  3. {tkfluent-0.1.5 → tkfluent-0.1.6}/tkflu/__main__.py +15 -11
  4. {tkfluent-0.1.5 → tkfluent-0.1.6}/tkflu/badge.py +12 -4
  5. {tkfluent-0.1.5 → tkfluent-0.1.6}/tkflu/button.py +12 -3
  6. tkfluent-0.1.6/tkflu/demos/demo.py +137 -0
  7. tkfluent-0.1.6/tkflu/demos/designer.py +48 -0
  8. {tkfluent-0.1.5 → tkfluent-0.1.6}/tkflu/designs/__init__.py +2 -1
  9. {tkfluent-0.1.5 → tkfluent-0.1.6}/tkflu/designs/button.py +4 -4
  10. tkfluent-0.1.6/tkflu/designs/renderer.py +19 -0
  11. {tkfluent-0.1.5 → tkfluent-0.1.6}/tkflu/designs/window.py +4 -2
  12. {tkfluent-0.1.5 → tkfluent-0.1.6}/tkflu/entry.py +8 -4
  13. {tkfluent-0.1.5 → tkfluent-0.1.6}/tkflu/frame.py +3 -2
  14. {tkfluent-0.1.5 → tkfluent-0.1.6}/tkflu/listbox.py +1 -1
  15. {tkfluent-0.1.5 → tkfluent-0.1.6}/tkflu/menu.py +13 -13
  16. {tkfluent-0.1.5 → tkfluent-0.1.6}/tkflu/menubar.py +9 -11
  17. {tkfluent-0.1.5 → tkfluent-0.1.6}/tkflu/popupmenu.py +1 -1
  18. {tkfluent-0.1.5 → tkfluent-0.1.6}/tkflu/popupwindow.py +24 -4
  19. {tkfluent-0.1.5 → tkfluent-0.1.6}/tkflu/scrollbar.py +2 -2
  20. {tkfluent-0.1.5 → tkfluent-0.1.6}/tkflu/slider.py +52 -25
  21. {tkfluent-0.1.5 → tkfluent-0.1.6}/tkflu/text.py +10 -3
  22. {tkfluent-0.1.5 → tkfluent-0.1.6}/tkflu/togglebutton.py +9 -3
  23. {tkfluent-0.1.5 → tkfluent-0.1.6}/tkflu/tooltip.py +2 -2
  24. tkfluent-0.1.5/tkflu/demos/designer.py +0 -33
  25. {tkfluent-0.1.5 → tkfluent-0.1.6}/README.md +0 -0
  26. {tkfluent-0.1.5 → tkfluent-0.1.6}/tkflu/__init__.py +0 -0
  27. {tkfluent-0.1.5 → tkfluent-0.1.6}/tkflu/bwm.py +0 -0
  28. {tkfluent-0.1.5 → tkfluent-0.1.6}/tkflu/checkbox.py +0 -0
  29. {tkfluent-0.1.5 → tkfluent-0.1.6}/tkflu/constants.py +0 -0
  30. {tkfluent-0.1.5 → tkfluent-0.1.6}/tkflu/customwindow.py +0 -0
  31. {tkfluent-0.1.5 → tkfluent-0.1.6}/tkflu/customwindow2.py +0 -0
  32. {tkfluent-0.1.5 → tkfluent-0.1.6}/tkflu/defs.py +0 -0
  33. {tkfluent-0.1.5 → tkfluent-0.1.6}/tkflu/demos/__init__.py +0 -0
  34. {tkfluent-0.1.5 → tkfluent-0.1.6}/tkflu/demos/acrylic1.py +0 -0
  35. {tkfluent-0.1.5 → tkfluent-0.1.6}/tkflu/demos/demo1.py +0 -0
  36. {tkfluent-0.1.5 → tkfluent-0.1.6}/tkflu/demos/grad.py +0 -0
  37. {tkfluent-0.1.5 → tkfluent-0.1.6}/tkflu/demos/grad2.py +0 -0
  38. {tkfluent-0.1.5 → tkfluent-0.1.6}/tkflu/demos/grad3.py +0 -0
  39. {tkfluent-0.1.5 → tkfluent-0.1.6}/tkflu/demos/screenshot.py +0 -0
  40. {tkfluent-0.1.5 → tkfluent-0.1.6}/tkflu/demos/scroll.py +0 -0
  41. {tkfluent-0.1.5 → tkfluent-0.1.6}/tkflu/demos/test.py +0 -0
  42. {tkfluent-0.1.5 → tkfluent-0.1.6}/tkflu/demos/tooltip.py +0 -0
  43. {tkfluent-0.1.5 → tkfluent-0.1.6}/tkflu/designs/animation.py +0 -0
  44. {tkfluent-0.1.5 → tkfluent-0.1.6}/tkflu/designs/badge.py +0 -0
  45. {tkfluent-0.1.5 → tkfluent-0.1.6}/tkflu/designs/design.py +0 -0
  46. {tkfluent-0.1.5 → tkfluent-0.1.6}/tkflu/designs/entry.py +0 -0
  47. {tkfluent-0.1.5 → tkfluent-0.1.6}/tkflu/designs/fonts/__init__.py +0 -0
  48. {tkfluent-0.1.5 → tkfluent-0.1.6}/tkflu/designs/fonts/segoe_fluent_icons.ttf +0 -0
  49. {tkfluent-0.1.5 → tkfluent-0.1.6}/tkflu/designs/fonts/segoeui.ttf +0 -0
  50. {tkfluent-0.1.5 → tkfluent-0.1.6}/tkflu/designs/frame.py +0 -0
  51. {tkfluent-0.1.5 → tkfluent-0.1.6}/tkflu/designs/gradient.py +0 -0
  52. {tkfluent-0.1.5 → tkfluent-0.1.6}/tkflu/designs/label.py +0 -0
  53. {tkfluent-0.1.5 → tkfluent-0.1.6}/tkflu/designs/menubar.py +0 -0
  54. {tkfluent-0.1.5 → tkfluent-0.1.6}/tkflu/designs/primary_color.py +0 -0
  55. {tkfluent-0.1.5 → tkfluent-0.1.6}/tkflu/designs/scrollbar.py +0 -0
  56. {tkfluent-0.1.5 → tkfluent-0.1.6}/tkflu/designs/slider.py +0 -0
  57. {tkfluent-0.1.5 → tkfluent-0.1.6}/tkflu/designs/text.py +0 -0
  58. {tkfluent-0.1.5 → tkfluent-0.1.6}/tkflu/designs/tooltip.py +0 -0
  59. {tkfluent-0.1.5 → tkfluent-0.1.6}/tkflu/icons.py +0 -0
  60. {tkfluent-0.1.5 → tkfluent-0.1.6}/tkflu/image.py +0 -0
  61. {tkfluent-0.1.5 → tkfluent-0.1.6}/tkflu/label.py +0 -0
  62. {tkfluent-0.1.5 → tkfluent-0.1.6}/tkflu/litenav.py +0 -0
  63. {tkfluent-0.1.5 → tkfluent-0.1.6}/tkflu/thememanager.py +0 -0
  64. {tkfluent-0.1.5 → tkfluent-0.1.6}/tkflu/toplevel.py +0 -0
  65. {tkfluent-0.1.5 → tkfluent-0.1.6}/tkflu/window.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: tkfluent
3
- Version: 0.1.5
3
+ Version: 0.1.6
4
4
  Summary: Fluent(SunValley) Design for Tkinter. Modern GUI
5
5
  License: GPL-3.0
6
6
  Keywords: tkfluent,tksvg,tkinter,fluent,modern,GUI,interface
@@ -30,7 +30,7 @@ Requires-Dist: easydict (>=1.13,<2.0)
30
30
  Requires-Dist: numpy
31
31
  Requires-Dist: pillow (>=10.2.0,<11.0.0)
32
32
  Requires-Dist: svgwrite (>=1.4.3,<2.0.0)
33
- Requires-Dist: tkdeft (==0.1.1)
33
+ Requires-Dist: tkdeft (==0.1.2)
34
34
  Requires-Dist: tkextrafont (>=0.6.3,<0.7.0)
35
35
  Requires-Dist: tksvg (>=0.7.4,<0.8.0)
36
36
  Project-URL: Documentation, https://tkfluent.netlify.app
@@ -1,12 +1,13 @@
1
1
  [tool.poetry]
2
2
  name = "tkfluent"
3
- version = "0.1.5"
3
+ version = "0.1.6"
4
4
  description = "Fluent(SunValley) Design for Tkinter. Modern GUI"
5
5
  authors = ["XiangQinxi <xiangqinxi@outlook.com>"]
6
6
  readme = "README.md"
7
7
  documentation = "https://tkfluent.netlify.app"
8
8
  packages = [
9
- { include = "tkflu" }
9
+ { include = "tkflu" },
10
+ #{ include = "tkflux" }
10
11
  ]
11
12
  license = "GPL-3.0"
12
13
  keywords = [ "tkfluent", "tksvg", "tkinter", "fluent", "modern", "GUI", "interface" ]
@@ -36,7 +37,7 @@ tksvg = "^0.7.4"
36
37
  tkextrafont = "^0.6.3"
37
38
  svgwrite = "^1.4.3"
38
39
  pillow = "^10.2.0"
39
- tkdeft = "0.1.1"
40
+ tkdeft = "0.1.2"
40
41
  easydict = "^1.13"
41
42
  numpy = "*"
42
43
 
@@ -3,8 +3,9 @@ from tkinter import *
3
3
  from tkinter.font import *
4
4
 
5
5
  blue_primary_color()
6
- set_animation_steps(10)
7
- set_animation_step_time(20)
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:
@@ -38,32 +39,35 @@ thememanager = FluThemeManager()
38
39
 
39
40
  menubar = FluMenuBar(root)
40
41
  menubar.add_command(
41
- label="FluMenu1", width=80, command=lambda: print("FluMenu1 -> Clicked")
42
+ label="FluMenu1", command=lambda: print("FluMenu1 -> Clicked")
42
43
  )
43
44
 
44
45
  menu1 = FluMenu()
45
46
  menu1.add_command(
46
- label="FluMenu2-1", width=80, command=lambda: print("FluMenu2-1 -> Clicked")
47
+ label="FluMenu2-1", command=lambda: print("FluMenu2-1 -> Clicked")
47
48
  )
48
49
  menubar.add_cascade(
49
- label="FluMenu2", width=80, menu=menu1
50
+ label="FluMenu2", menu=menu1
50
51
  )
51
52
 
52
53
  menu2 = FluMenu(height=93)
53
54
  menu2.add_command(
54
- label="FluMenu3-1", width=80, command=lambda: print("FluMenu3-1 -> Clicked")
55
+ label="FluMenu3-1", command=lambda: print("FluMenu3-1 -> Clicked")
55
56
  )
56
57
 
57
- menu3 = FluMenu(height=46, width=10)
58
+ menu3 = FluMenu(height=93)
58
59
  menu3.add_command(
59
- label="FluMenu3-2-1", width=80, command=lambda: print("FluMenu3-2-1 -> Clicked")
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")
60
64
  )
61
65
 
62
66
  menu2.add_cascade(
63
- label="FluMenu3-2", width=80, menu=menu3
67
+ label="FluMenu3-2", menu=menu3
64
68
  )
65
69
  menubar.add_cascade(
66
- label="FluMenu3", width=80, menu=menu2
70
+ label="FluMenu3", menu=menu2
67
71
  )
68
72
 
69
73
  menubar.pack(fill="x")
@@ -118,7 +122,7 @@ entry1.pack(fill="x", padx=5, pady=5)
118
122
  text1 = FluText(frame)
119
123
  text1.pack(fill="x", padx=5, pady=5)
120
124
 
121
- slider1 = FluSlider(frame, value=5, min=0, max=10, tick=False, changed=lambda: print(f"FluSlider -> Changed -> Value: {slider1.dcget('value')}"))
125
+ slider1 = FluSlider(frame, value=5, min=0, max=10, tick=True, changed=lambda: print(f"FluSlider -> Changed -> Value: {slider1.dcget('value')}"))
122
126
  slider1.pack(fill="x", padx=5, pady=5)
123
127
 
124
128
  """listbox1 = FluListBox(frame)
@@ -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
- self._tkimg = self.svgdraw.create_tksvg_image(self._img)
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, self.winfo_width(), self.winfo_height(), temppath=self.temppath,
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
  )
@@ -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
- self._tkimg = self.svgdraw.create_tksvg_image(self._img) # 用tksvg读取svg图片
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,
@@ -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()
@@ -0,0 +1,48 @@
1
+ from tkflu import *
2
+
3
+ set_renderer(1)
4
+ set_animation_steps(10)
5
+ set_animation_step_time(10)
6
+
7
+ root = FluWindow()
8
+ root.title("tkfluent designer")
9
+ root.geometry("600x300")
10
+
11
+ theme_manager = FluThemeManager(root)
12
+
13
+ menubar = FluMenuBar(root)
14
+
15
+ menu1 = FluMenu()
16
+ menu1.geometry("90x90")
17
+ menu1.add_command(label="Light", command=lambda: theme_manager.mode("light"))
18
+ menu1.add_command(label="Dark", command=lambda: theme_manager.mode("dark"))
19
+
20
+ def func1():
21
+ messagebox = FluToplevel()
22
+ messagebox.geometry("300x200")
23
+
24
+ label = FluLabel(messagebox, text="This is a example for tkfluent!", width=160, height=32)
25
+ label.pack(anchor="center")
26
+
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())
32
+
33
+ menubar.show()
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)
47
+
48
+ root.mainloop()
@@ -2,4 +2,5 @@ from .design import FluDesign
2
2
  from .primary_color import FluPrimaryColor, set_primary_color, get_primary_color
3
3
  from .animation import FluAnimation, set_animation_steps, set_animation_step_time, get_animation_steps, get_animation_step_time
4
4
  from .gradient import FluGradient
5
- from .fonts import *
5
+ from .fonts import *
6
+ from .renderer import FluRenderer, set_renderer, get_renderer
@@ -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": "#F9F9F9",
124
- "back_opacity": 0,
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": "#F9F9F9",
136
- "back_opacity": "0.3",
135
+ "back_color": "#ededed",
136
+ "back_opacity": "1",
137
137
  "border_color": "#000000",
138
138
  "border_color_opacity": "0",
139
139
  "border_color2": None,
@@ -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"])
@@ -7,7 +7,8 @@ def window(mode):
7
7
  "back_color": "#cf392d",
8
8
  "text_color": "#000000",
9
9
  "text_hover_color": "#ffffff"
10
- }
10
+ },
11
+ "transparent_color": "grey"
11
12
  }
12
13
  else:
13
14
  return {
@@ -17,5 +18,6 @@ def window(mode):
17
18
  "back_color": "#c42b1c",
18
19
  "text_color": "#ffffff",
19
20
  "text_hover_color": "#000000"
20
- }
21
+ },
22
+ "transparent_color": "grey"
21
23
  }
@@ -54,7 +54,7 @@ class FluEntryCanvas(DCanvas):
54
54
  draw = FluEntryDraw
55
55
 
56
56
  def create_round_rectangle(self,
57
- x1, y1, x2, y2, r1, r2=None, temppath=None,
57
+ x1, y1, x2, y2, r1, r2=None, temppath=None, temppath2=None,
58
58
  fill="transparent", fill_opacity=1, stop1="0.93", stop2="0.94",
59
59
  outline="black", outline2="black", outline_opacity=1, outline2_opacity=1,
60
60
  width=1
@@ -65,7 +65,8 @@ class FluEntryCanvas(DCanvas):
65
65
  outline=outline, outline2=outline2, outline_opacity=outline_opacity, outline2_opacity=outline2_opacity,
66
66
  width=width
67
67
  )
68
- self._tkimg = self.svgdraw.create_tksvg_image(self._img)
68
+ from .designs.renderer import get_renderer
69
+ self._tkimg = self.svgdraw.create_svg_image(self._img, temppath2, way=get_renderer())
69
70
  return self.create_image(x1, y1, anchor="nw", image=self._tkimg)
70
71
 
71
72
  create_roundrect = create_round_rectangle
@@ -168,9 +169,12 @@ class FluEntry(FluEntryCanvas, DDrawWidget, FluToolTipBase):
168
169
 
169
170
  self.entry.configure(background=_back_color, insertbackground=_text_color, foreground=_text_color,
170
171
  disabledbackground=_back_color, disabledforeground=_text_color)
171
-
172
+ from .designs.renderer import get_renderer
173
+ if get_renderer() == 1:
174
+ width -= 1
175
+ height -= 1
172
176
  self.element_border = self.create_round_rectangle(
173
- 0, 0, width, height, _radius, temppath=self.temppath,
177
+ 0, 0, width, height, _radius, temppath=self.temppath, temppath2=self.temppath3,
174
178
  fill=_back_color, fill_opacity=_back_opacity, stop1=_stop1, stop2=_stop2,
175
179
  outline=_border_color, outline_opacity=_border_color_opacity, outline2=_border_color2,
176
180
  outline2_opacity=_border_color2_opacity,
@@ -110,7 +110,8 @@ class FluFrameCanvas(DCanvas):
110
110
  fill=fill, #fill_opacity=fill_opacity,
111
111
  outline=outline, outline_opacity=outline_opacity, width=width
112
112
  )
113
- self._tkimg = self.svgdraw.create_tksvg_image(self._img)
113
+ from .designs.renderer import get_renderer
114
+ self._tkimg = self.svgdraw.create_svg_image(self._img)
114
115
  return self.create_image(x1, y1, anchor="nw", image=self._tkimg)
115
116
 
116
117
  create_roundrect = create_round_rectangle
@@ -194,7 +195,7 @@ class FluFrame(Frame, DObject, FluGradient):
194
195
  back_colors = self.generate_hex2hex(self.attributes.back_color, n["back_color"], steps=animation_steps)
195
196
  for i in range(animation_steps):
196
197
  def update(ii=i): # 使用默认参数立即捕获i的值
197
- print(back_colors[ii])
198
+ #print(back_colors[ii])
198
199
  self._draw(tempcolor=back_colors[ii])
199
200
  self.update()
200
201
 
@@ -40,7 +40,7 @@ class FluListBoxCanvas(DCanvas):
40
40
  x1, y1, x2, y2, r1, r2, temppath=temppath,
41
41
  fill=fill, outline=outline, outline2=outline2, width=width
42
42
  )
43
- self._tkimg = self.svgdraw.create_tksvg_image(self._img)
43
+ self._tkimg = self.svgdraw.create_svg_image(self._img)
44
44
  return self.create_image(x1, y1, anchor="nw", image=self._tkimg)
45
45
 
46
46
  create_roundrect = create_round_rectangle
@@ -4,7 +4,7 @@ from .tooltip import FluToolTipBase
4
4
 
5
5
 
6
6
  class FluMenu(FluPopupMenu, FluToolTipBase):
7
- def __init__(self, *args, **kwargs):
7
+ def __init__(self, height=None, *args, **kwargs):
8
8
  super().__init__(*args, **kwargs)
9
9
 
10
10
  def _init(self, mode, style):
@@ -25,16 +25,14 @@ class FluMenu(FluPopupMenu, FluToolTipBase):
25
25
 
26
26
  self.theme(mode=mode, style=style)
27
27
 
28
- def add_command(self, custom_widget=None, width=40, **kwargs):
28
+ def add_command(self, custom_widget=None, width=None, label: str = "", **kwargs):
29
+ if width is None:
30
+ width = len(label)*8
29
31
  if custom_widget:
30
32
  widget = custom_widget(self)
31
33
  else:
32
34
  from .button import FluButton
33
35
  widget = FluButton(self, width=width)
34
- if "label" in kwargs:
35
- label = kwargs.pop("label")
36
- else:
37
- label = ""
38
36
  if "style" in kwargs:
39
37
  style = kwargs.pop("style")
40
38
  else:
@@ -66,16 +64,14 @@ class FluMenu(FluPopupMenu, FluToolTipBase):
66
64
  widget.pack(side="top", fill="x", padx=1, pady=(1, 0))
67
65
  self.dcget("actions")[id] = widget
68
66
 
69
- def add_cascade(self, custom_widget=None, width=40, menu=None, **kwargs):
67
+ def add_cascade(self, custom_widget=None, width=None, menu=None, label: str = "", **kwargs):
68
+ if width is None:
69
+ width = len(label)*8
70
70
  if custom_widget:
71
71
  widget = custom_widget(self)
72
72
  else:
73
73
  from .button import FluButton
74
74
  widget = FluButton(self, width=width)
75
- if "label" in kwargs:
76
- label = kwargs.pop("label")
77
- else:
78
- label = ""
79
75
  if "style" in kwargs:
80
76
  style = kwargs.pop("style")
81
77
  else:
@@ -86,9 +82,13 @@ class FluMenu(FluPopupMenu, FluToolTipBase):
86
82
  id = widget._w
87
83
 
88
84
  def command(event=None):
85
+ self.l1 = True
89
86
  #print(menu._w)
90
87
 
91
- menu.popup(widget.winfo_rootx()+widget.winfo_width()+self.winfo_width(), widget.winfo_rooty())
88
+ menu.popup(widget.winfo_rootx()+widget.winfo_width(), widget.winfo_rooty()-5)
89
+ height = len(self.dcget("actions")) * 45
90
+ #print(height)
91
+ menu.window.geometry(f"100x{height}")
92
92
  menu.window.deiconify()
93
93
  menu.window.attributes("-topmost")
94
94
 
@@ -102,4 +102,4 @@ class FluMenu(FluPopupMenu, FluToolTipBase):
102
102
  widget.theme(style=style)
103
103
 
104
104
  widget.pack(side="top", fill="x", padx=1, pady=(1, 0))
105
- self.dcget("actions")[id] = widget
105
+ self.dcget("actions")[id] = widget
@@ -31,16 +31,14 @@ class FluMenuBar(Frame, DObject, FluGradient):
31
31
  def show(self):
32
32
  self.pack(fill="x")
33
33
 
34
- def add_command(self, custom_widget=None, width=40, **kwargs):
34
+ def add_command(self, custom_widget=None, width=None, label: str = "", **kwargs):
35
+ if width is None:
36
+ width = len(label)*8
35
37
  if custom_widget:
36
38
  widget = custom_widget(self)
37
39
  else:
38
40
  from .button import FluButton
39
41
  widget = FluButton(self, width=width)
40
- if "label" in kwargs:
41
- label = kwargs.pop("label")
42
- else:
43
- label = ""
44
42
  if "style" in kwargs:
45
43
  style = kwargs.pop("style")
46
44
  else:
@@ -69,16 +67,14 @@ class FluMenuBar(Frame, DObject, FluGradient):
69
67
 
70
68
  from .menu import FluMenu
71
69
 
72
- def add_cascade(self, custom_widget=None, width=40, menu: FluMenu = None, **kwargs):
70
+ def add_cascade(self, custom_widget=None, width=None, label: str = "", menu: FluMenu = None, **kwargs):
71
+ if width is None:
72
+ width = len(label)*8
73
73
  if custom_widget:
74
74
  widget = custom_widget(self)
75
75
  else:
76
76
  from .button import FluButton
77
77
  widget = FluButton(self, width=width)
78
- if "label" in kwargs:
79
- label = kwargs.pop("label")
80
- else:
81
- label = ""
82
78
  if "style" in kwargs:
83
79
  style = kwargs.pop("style")
84
80
  else:
@@ -90,7 +86,9 @@ class FluMenuBar(Frame, DObject, FluGradient):
90
86
 
91
87
  def command():
92
88
  menu.focus_set()
93
- menu.popup(widget.winfo_rootx(), widget.winfo_rooty() + widget.winfo_height())
89
+ menu.popup(widget.winfo_rootx()-5, widget.winfo_rooty() + widget.winfo_height())
90
+ height = len(menu.dcget("actions")) * 45
91
+ menu.window.geometry(f"100x{height}")
94
92
  menu.window.deiconify()
95
93
  menu.window.attributes("-topmost")
96
94
 
@@ -8,7 +8,7 @@ class FluPopupMenuWindow(FluPopupWindow):
8
8
 
9
9
 
10
10
  class FluPopupMenu(FluFrame):
11
- def __init__(self, *args, width=100, height=46, transparent_color="gray", style="popupmenu", **kwargs):
11
+ def __init__(self, *args, width=100, height=46, transparent_color=None, style="popupmenu", **kwargs):
12
12
  self.window = FluPopupMenuWindow(transparent_color=transparent_color, width=width, height=height)
13
13
 
14
14
  super().__init__(self.window, *args, style=style, **kwargs)
@@ -1,23 +1,40 @@
1
1
  from tkinter import Toplevel
2
2
 
3
+ from vbuild import hasSass
4
+
3
5
 
4
6
  class FluPopupWindow(Toplevel):
5
- def __init__(self, *args, transparent_color="#ebebeb", mode="light", width=100, height=46, custom=True, **kwargs):
7
+ def __init__(self, *args, transparent_color=None, mode="light", width=100, height=46, custom=True, **kwargs):
6
8
  super().__init__(*args, background=transparent_color, **kwargs)
7
9
 
8
10
  self.theme(mode=mode)
9
11
 
12
+ self._transparent_color = transparent_color
13
+
10
14
  if width > 0 and height > 0:
11
15
  self.geometry(f"{width}x{height}")
12
16
 
13
17
  if custom:
14
- self.transient_color = transparent_color
15
18
  self.overrideredirect(True)
16
- self.wm_attributes("-transparentcolor", transparent_color)
19
+
20
+ self._draw()
17
21
 
18
22
  self.withdraw()
19
23
 
20
24
  self.bind("<FocusOut>", self._event_focusout, add="+")
25
+ self.bind("<Configure>", self._draw)
26
+
27
+ def _draw(self, event=None):
28
+ if hasattr(self, "tk"):
29
+ if self.overrideredirect():
30
+ if self._transparent_color is None:
31
+ from .designs.window import window
32
+ self.transparent_color = window(self.mode)["transparent_color"]
33
+ else:
34
+ self.transparent_color = self._transparent_color
35
+ #print(self.transparent_color)
36
+ self.wm_attributes("-transparentcolor", self.transparent_color)
37
+ self.configure(background=self.transparent_color)
21
38
 
22
39
  def _event_focusout(self, event=None):
23
40
  """self.wm_attributes("-alpha", 1)
@@ -45,9 +62,11 @@ class FluPopupWindow(Toplevel):
45
62
  FRAMES_COUNT = get_animation_steps()
46
63
  FRAME_DELAY = get_animation_step_time()
47
64
 
65
+ #print(FRAMES_COUNT,FRAME_DELAY)
66
+
48
67
  self.geometry(f"+{x}+{y}")
49
68
  #self.focus_set()
50
- if not FRAMES_COUNT == 0 or not FRAME_DELAY == 0:
69
+ if FRAMES_COUNT != 0 or FRAME_DELAY != 0:
51
70
  self.wm_attributes("-alpha", 0.0)
52
71
  self.deiconify()
53
72
 
@@ -65,6 +84,7 @@ class FluPopupWindow(Toplevel):
65
84
  def theme(self, mode=None):
66
85
  if mode:
67
86
  self.mode = mode
87
+ self._draw()
68
88
  for widget in self.winfo_children():
69
89
  if hasattr(widget, "theme"):
70
90
  widget.theme(mode=self.mode.lower())
@@ -57,7 +57,7 @@ class FluScrollBarCanvas(DCanvas):
57
57
  x1, y1, x2, y2, r1, r2, temppath=temppath,
58
58
  fill=fill
59
59
  )
60
- self._tkimg = self.svgdraw.create_tksvg_image(self._img)
60
+ self._tkimg = self.svgdraw.create_svg_image(self._img)
61
61
  return self.create_image(x1, y1, anchor="nw", image=self._tkimg)
62
62
 
63
63
  def create_thumb(
@@ -69,7 +69,7 @@ class FluScrollBarCanvas(DCanvas):
69
69
  x1, y1, x2, y2, r1, r2, temppath=temppath,
70
70
  fill=fill
71
71
  )
72
- self._tkimg2 = self.svgdraw.create_tksvg_image(self._img2)
72
+ self._tkimg2 = self.svgdraw.create_svg_image(self._img2)
73
73
  return self.create_image(x1, y1, anchor="nw", image=self._tkimg2)
74
74
 
75
75
 
@@ -82,7 +82,7 @@ class FluSliderCanvas(DCanvas):
82
82
 
83
83
  def create_track(
84
84
  self,
85
- x1, y1, width, height, width2, temppath=None, radius=3,
85
+ x1, y1, width, height, width2, temppath=None, temppath2=None, radius=3,
86
86
  track_fill="transparent", track_opacity=1,
87
87
  rail_fill="transparent", rail_opacity=1
88
88
  ):
@@ -91,13 +91,14 @@ class FluSliderCanvas(DCanvas):
91
91
  track_fill=track_fill, track_opacity=track_opacity,
92
92
  rail_fill=rail_fill, rail_opacity=rail_opacity
93
93
  )
94
- self._tkimg2 = self.svgdraw.create_tksvg_image(self._img2)
94
+ from .designs.renderer import get_renderer
95
+ self._tkimg2 = self.svgdraw.create_svg_image(self._img2, temppath2, way=get_renderer())
95
96
  #print(self._img2)
96
97
  return self.create_image(x1, y1, anchor="nw", image=self._tkimg2)
97
98
 
98
99
  def create_thumb(
99
100
  self,
100
- x1, y1, width, height, r1, r2, temppath=None,
101
+ x1, y1, width, height, r1, r2, temppath=None, temppath2=None,
101
102
  fill="transparent", fill_opacity=1,
102
103
  outline="transparent", outline_opacity=1,
103
104
  outline2="transparent", outline2_opacity=1,
@@ -110,7 +111,8 @@ class FluSliderCanvas(DCanvas):
110
111
  outline2=outline2, outline2_opacity=outline2_opacity,
111
112
  inner_fill=inner_fill, inner_fill_opacity=inner_fill_opacity,
112
113
  )
113
- self._tkimg = self.svgdraw.create_tksvg_image(self._img)
114
+ from .designs.renderer import get_renderer
115
+ self._tkimg = self.svgdraw.create_svg_image(self._img, temppath2, way=get_renderer())
114
116
  return self.create_image(x1, y1, anchor="nw", image=self._tkimg)
115
117
 
116
118
 
@@ -286,28 +288,53 @@ class FluSlider(FluSliderCanvas, DDrawWidget):
286
288
 
287
289
  # 确保不会超出右边界
288
290
  thumb_left = min(thumb_left, self.winfo_width() - thumb_width)
291
+ from .designs.renderer import get_renderer
292
+ if get_renderer() == 0:
293
+ # 创建轨道时,width2 参数应为选中部分的宽度(滑块中心位置)
294
+ self.element_track = self.create_track(
295
+ _thumb_width / 4,
296
+ height / 2 - _track_height,
297
+ self.winfo_width() - _thumb_width / 2,
298
+ _track_height,
299
+ thumb_center - _thumb_width / 4, # 关键修正:使用滑块中心相对于轨道起点的距离
300
+ temppath=self.temppath, temppath2=self.temppath3, radius=_radius,
301
+ track_fill=_track_back_color, track_opacity=_track_back_opacity,
302
+ rail_fill=_rail_back_color, rail_opacity=_rail_back_opacity
303
+ )
304
+
305
+ self.element_thumb = self.create_thumb(
306
+ thumb_left, 0, # 直接使用计算出的左上角位置
307
+ thumb_width, thumb_width,
308
+ _thumb_radius, _thumb_inner_radius,
309
+ temppath=self.temppath2, temppath2=self.temppath4, fill=_thumb_back_color, fill_opacity=_thumb_back_opacity,
310
+ outline=_thumb_border_color, outline_opacity=_thumb_border_color_opacity,
311
+ outline2=_thumb_border_color2, outline2_opacity=_thumb_border_color2_opacity,
312
+ inner_fill=_thumb_inner_back_color, inner_fill_opacity=_thumb_inner_back_opacity,
313
+ )
314
+ elif get_renderer() == 1:
315
+ # 创建轨道时,width2 参数应为选中部分的宽度(滑块中心位置)
316
+ self.element_track = self.create_track(
317
+ _thumb_width / 4,
318
+ height / 2 - _track_height,
319
+ self.winfo_width() - _thumb_width / 2 - 1,
320
+ _track_height - 1,
321
+ thumb_center - _thumb_width / 4, # 关键修正:使用滑块中心相对于轨道起点的距离
322
+ temppath=self.temppath, temppath2=self.temppath3, radius=_radius,
323
+ track_fill=_track_back_color, track_opacity=_track_back_opacity,
324
+ rail_fill=_rail_back_color, rail_opacity=_rail_back_opacity
325
+ )
326
+
327
+ self.element_thumb = self.create_thumb(
328
+ thumb_left, 0, # 直接使用计算出的左上角位置
329
+ thumb_width - 3.5, thumb_width - 3.5,
330
+ _thumb_radius, _thumb_inner_radius,
331
+ temppath=self.temppath2, temppath2=self.temppath4, fill=_thumb_back_color,
332
+ fill_opacity=_thumb_back_opacity,
333
+ outline=_thumb_border_color, outline_opacity=_thumb_border_color_opacity,
334
+ outline2=_thumb_border_color2, outline2_opacity=_thumb_border_color2_opacity,
335
+ inner_fill=_thumb_inner_back_color, inner_fill_opacity=_thumb_inner_back_opacity,
336
+ )
289
337
 
290
- # 创建轨道时,width2 参数应为选中部分的宽度(滑块中心位置)
291
- self.element_track = self.create_track(
292
- _thumb_width / 4,
293
- height / 2 - _track_height,
294
- self.winfo_width() - _thumb_width / 2,
295
- _track_height,
296
- thumb_center - _thumb_width / 4, # 关键修正:使用滑块中心相对于轨道起点的距离
297
- temppath=self.temppath, radius=_radius,
298
- track_fill=_track_back_color, track_opacity=_track_back_opacity,
299
- rail_fill=_rail_back_color, rail_opacity=_rail_back_opacity
300
- )
301
-
302
- self.element_thumb = self.create_thumb(
303
- thumb_left, 0, # 直接使用计算出的左上角位置
304
- thumb_width, thumb_width,
305
- _thumb_radius, _thumb_inner_radius,
306
- temppath=self.temppath2, fill=_thumb_back_color, fill_opacity=_thumb_back_opacity,
307
- outline=_thumb_border_color, outline_opacity=_thumb_border_color_opacity,
308
- outline2=_thumb_border_color2, outline2_opacity=_thumb_border_color2_opacity,
309
- inner_fill=_thumb_inner_back_color, inner_fill_opacity=_thumb_inner_back_opacity,
310
- )
311
338
 
312
339
  self._e1 = self.tag_bind(self.element_thumb, "<Enter>", self._event_enter_thumb, add="+")
313
340
  self._e2 = self.tag_bind(self.element_thumb, "<Leave>", self._event_leave_thumb, add="+")
@@ -55,7 +55,7 @@ class FluTextCanvas(DCanvas):
55
55
  draw = FluTextDraw
56
56
 
57
57
  def create_round_rectangle(self,
58
- x1, y1, x2, y2, r1, r2=None, temppath=None,
58
+ x1, y1, x2, y2, r1, r2=None, temppath=None, temppath2=None,
59
59
  fill="transparent", fill_opacity=1, stop1="0.93", stop2="0.94",
60
60
  outline="black", outline2="black", outline_opacity=1, outline2_opacity=1,
61
61
  width=1
@@ -66,7 +66,8 @@ class FluTextCanvas(DCanvas):
66
66
  outline=outline, outline2=outline2, outline_opacity=outline_opacity, outline2_opacity=outline2_opacity,
67
67
  width=width
68
68
  )
69
- self._tkimg = self.svgdraw.create_tksvg_image(self._img)
69
+ from .designs.renderer import get_renderer
70
+ self._tkimg = self.svgdraw.create_svg_image(self._img, temppath2, way=get_renderer())
70
71
  return self.create_image(x1, y1, anchor="nw", image=self._tkimg)
71
72
 
72
73
  create_roundrect = create_round_rectangle
@@ -174,8 +175,14 @@ class FluText(FluTextCanvas, DDrawWidget, FluToolTipBase):
174
175
 
175
176
  if hasattr(self, "element_border"):
176
177
  self.delete(self.element_border)
178
+
179
+ from .designs.renderer import get_renderer
180
+ if get_renderer() == 1:
181
+ width -= 1
182
+ height -= 1
183
+
177
184
  self.element_border = self.create_round_rectangle(
178
- 0, 0, width, height, _radius, temppath=self.temppath,
185
+ 0, 0, width, height, _radius, temppath=self.temppath, temppath2=self.temppath3,
179
186
  fill=_back_color, fill_opacity=_back_opacity, stop1=_stop1, stop2=_stop2,
180
187
  outline=_border_color, outline_opacity=_border_color_opacity, outline2=_border_color2,
181
188
  outline2_opacity=_border_color2_opacity,
@@ -43,7 +43,7 @@ class FluToggleButtonCanvas(DCanvas):
43
43
  draw = FluToggleButtonDraw
44
44
 
45
45
  def create_round_rectangle_with_text(self,
46
- x1, y1, x2, y2, r1, r2=None, temppath=None,
46
+ x1, y1, x2, y2, r1, r2=None, temppath=None, temppath2=None,
47
47
  fill="transparent", fill_opacity=1,
48
48
  outline="black", outline2="black", outline_opacity=1, outline2_opacity=1,
49
49
  width=1,
@@ -54,7 +54,8 @@ class FluToggleButtonCanvas(DCanvas):
54
54
  outline=outline, outline2=outline2, outline_opacity=outline_opacity, outline2_opacity=outline2_opacity,
55
55
  width=width,
56
56
  )
57
- self._tkimg = self.svgdraw.create_tksvg_image(self._img)
57
+ from .designs.renderer import get_renderer
58
+ self._tkimg = self.svgdraw.create_svg_image(self._img, temppath2, way=get_renderer())
58
59
  return self.create_image(x1, y1, anchor="nw", image=self._tkimg)
59
60
 
60
61
  create_roundrect = create_round_rectangle_with_text
@@ -174,8 +175,13 @@ class FluToggleButton(FluToggleButtonCanvas, DDrawWidget, FluToolTipBase, FluGra
174
175
  _radius = tempcolor.radius
175
176
  _text_color = tempcolor.text_color
176
177
 
178
+ from .designs.renderer import get_renderer
179
+ if get_renderer() == 1:
180
+ width -= 1
181
+ height -= 1
182
+
177
183
  self.element_border = self.create_round_rectangle_with_text(
178
- 0, 0, width, height, _radius, temppath=self.temppath,
184
+ 0, 0, width, height, _radius, temppath=self.temppath, temppath2=self.temppath3,
179
185
  fill=_back_color, fill_opacity=_back_opacity,
180
186
  outline=_border_color, outline_opacity=_border_color_opacity, outline2=_border_color2,
181
187
  outline2_opacity=_border_color2_opacity,
@@ -5,7 +5,7 @@ import sys
5
5
 
6
6
  class FluToolTip(FluPopupWindow):
7
7
  def __init__(self, widget: Widget, text, mode="light", delay=400, show_time=100.0, *args, **kwargs):
8
- super().__init__(*args, transparent_color="#ebebeb", **kwargs)
8
+ super().__init__(*args, **kwargs)
9
9
 
10
10
  from .label import FluLabel
11
11
  from .frame import FluFrame
@@ -69,7 +69,7 @@ class FluToolTip(FluPopupWindow):
69
69
 
70
70
  class FluToolTip2(FluPopupWindow):
71
71
  def __init__(self, widget, text, mode="light", *args, **kwargs):
72
- super().__init__(*args, transparent_color="#ebebeb", **kwargs)
72
+ super().__init__(*args, **kwargs)
73
73
 
74
74
  from .label import FluLabel
75
75
  from .frame import FluFrame
@@ -1,33 +0,0 @@
1
- from tkflu import *
2
-
3
- set_animation_steps(10)
4
- set_animation_step_time(10)
5
-
6
- root = FluWindow()
7
- root.title("tkfluent designer")
8
- root.geometry("500x300")
9
-
10
- theme_manager = FluThemeManager(root)
11
-
12
- menubar = FluMenuBar(root)
13
-
14
- menu1 = FluMenu()
15
- menu1.geometry("90x90")
16
- menu1.add_command(label="Light", command=lambda: theme_manager.mode("light"))
17
- menu1.add_command(label="Dark", command=lambda: theme_manager.mode("dark"))
18
-
19
- def func1():
20
- messagebox = FluToplevel()
21
- messagebox.geometry("300x200")
22
-
23
- label = FluLabel(messagebox, text="This is a example for tkfluent!", width=160, height=32)
24
- label.pack(anchor="center")
25
-
26
- menubar.add_command(label="File", style="standard", width=40, command=lambda: print("File -> Clicked"))
27
- menubar.add_cascade(label="Theme Mode", style="standard", width=85, menu=menu1)
28
- menubar.add_command(label="About", style="standard", width=45, command=lambda: func1())
29
-
30
- menubar.show()
31
-
32
-
33
- root.mainloop()
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes