tkfluent 0.0.1__py2.py3-none-any.whl → 0.0.2__py2.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/window.py CHANGED
@@ -3,8 +3,20 @@ from tkdeft.object import DObject
3
3
 
4
4
 
5
5
  class FluWindow(Tk, DObject):
6
+
7
+ """Fluent设计的主窗口"""
8
+
6
9
  def __init__(self, *args, className="tkdeft", mode="light", **kwargs):
7
10
 
11
+ """
12
+ 初始化类
13
+
14
+ :param args: 参照tkinter.TK.__init__
15
+ :param className: 参照tkinter.TK.__init__
16
+ :param mode: Fluent主题模式 分为 “light” “dark”
17
+ :param kwargs: 参照tkinter.TK.__init__
18
+ """
19
+
8
20
  self._init(mode)
9
21
 
10
22
  self.custom = False
@@ -13,13 +25,22 @@ class FluWindow(Tk, DObject):
13
25
 
14
26
  self.bind("<Configure>", self._event_configure)
15
27
 
16
- def _event_configure(self, event=None):
28
+ def _draw(self, event=None):
29
+
30
+ """
31
+ 重新绘制窗口及自定义的窗口组件
32
+
33
+ :param event:
34
+ """
35
+
17
36
  self.configure(background=self.attributes.back_color)
18
37
  if self.custom:
19
38
  if hasattr(self, "titlebar"):
20
39
  self.titlebar.configure(background=self.attributes.back_color)
40
+ self.titlebar.update()
21
41
  if hasattr(self, "titlelabel"):
22
42
  self.titlelabel.dconfigure(text_color=self.attributes.text_color)
43
+ self.titlelabel._draw()
23
44
  if hasattr(self, "closebutton"):
24
45
  self.closebutton.dconfigure(
25
46
  rest={
@@ -47,6 +68,18 @@ class FluWindow(Tk, DObject):
47
68
  "text_color": self.attributes.closebutton.text_hover_color,
48
69
  }
49
70
  )
71
+ self.closebutton._draw()
72
+
73
+ def _event_configure(self, event=None):
74
+
75
+ """
76
+ 触发 `<Configure>` 事件
77
+
78
+ :param event:
79
+ :return:
80
+ """
81
+
82
+ self._draw()
50
83
 
51
84
  def _init(self, mode):
52
85
  from easydict import EasyDict
@@ -65,6 +98,26 @@ class FluWindow(Tk, DObject):
65
98
  self.theme(mode)
66
99
 
67
100
  def theme(self, mode: str):
101
+
102
+ """
103
+ 同 `theme_myself`
104
+
105
+ :param mode:
106
+ :return:
107
+ """
108
+
109
+ self.theme_myself(mode=mode)
110
+
111
+ def theme_myself(self, mode: str):
112
+
113
+ """
114
+ 修改该窗口的Fluent主题
115
+
116
+ :param mode:
117
+ :return:
118
+ """
119
+
120
+ self.mode = mode
68
121
  if mode.lower() == "dark":
69
122
  self._dark()
70
123
  else:
@@ -92,21 +145,53 @@ class FluWindow(Tk, DObject):
92
145
  }
93
146
  )
94
147
 
95
- def wincustom(self, wait=200):
148
+ def wincustom(self, wait=200, way=1):
149
+
150
+ """
151
+ 自定义窗口 仅限`Windows系统`
152
+
153
+ :param wait: 直接执行自定义窗口容易出错误 需要一点时间等待才能执行 同`after()`中的`ms`
154
+ :param way: 取0时保留原版边框,但稳定性很差,容易崩溃。取1时不保留原版边框,但稳定性较好。
155
+ :return:
156
+ """
157
+
96
158
  from sys import platform
159
+ from .button import FluButton
160
+ from .label import FluLabel
161
+ from tkinter import Frame
162
+ self.titlebar = Frame(self, width=180, height=35, background=self.attributes.back_color)
163
+ self.titlelabel = FluLabel(self.titlebar, text=self.title(), width=50)
164
+ self.titlelabel.pack(fill="y", side="left")
165
+ self.closebutton = FluButton(self.titlebar, text="", width=32, height=32, command=lambda: self.quit())
166
+ self.closebutton.pack(fill="y", side="right")
167
+ self.titlebar.pack(fill="x", side="top")
168
+
97
169
  if platform == "win32":
98
- from .button import FluButton
99
- from .label import FluLabel
100
- from tkinter import Frame
101
- self.titlebar = Frame(self, width=180, height=35)
102
- self.titlelabel = FluLabel(self.titlebar, text=self.title(), width=50)
103
- self.titlelabel.pack(fill="y", side="left")
104
- self.closebutton = FluButton(self.titlebar, text="", width=32, height=32, command=lambda: self.quit())
105
- self.closebutton.pack(fill="y", side="right")
106
- self.titlebar.pack(fill="x", side="top")
107
-
108
- from .customwindow import CustomWindow
109
- self.customwindow = CustomWindow(self, wait=wait)
110
- self.customwindow.bind_drag(self.titlebar)
111
- self.customwindow.bind_drag(self.titlelabel)
112
- self.custom = True
170
+ if way == 0:
171
+ from .customwindow import CustomWindow
172
+ self.customwindow = CustomWindow(self, wait=wait)
173
+ self.customwindow.bind_drag(self.titlebar)
174
+ self.customwindow.bind_drag(self.titlelabel)
175
+ else:
176
+ self.overrideredirect(True)
177
+ try:
178
+ from win32gui import GetParent, GetWindowLong, SetWindowLong
179
+ from win32con import GWL_EXSTYLE, WS_EX_APPWINDOW, WS_EX_TOOLWINDOW
180
+ hwnd = GetParent(self.winfo_id())
181
+ style = GetWindowLong(hwnd, GWL_EXSTYLE)
182
+ style = style & ~WS_EX_TOOLWINDOW
183
+ style = style | WS_EX_APPWINDOW
184
+ SetWindowLong(hwnd, GWL_EXSTYLE, style)
185
+ self.after(30, lambda: self.withdraw())
186
+ self.after(60, lambda: self.deiconify())
187
+ except:
188
+ pass
189
+
190
+ self.wm_attributes("-topmost", True)
191
+
192
+ from .customwindow2 import WindowDragArea
193
+ self.dragarea = WindowDragArea(self)
194
+ self.dragarea.bind(self.titlebar)
195
+ self.dragarea.bind(self.titlelabel)
196
+
197
+ self.custom = True
@@ -0,0 +1,23 @@
1
+ Metadata-Version: 2.1
2
+ Name: tkfluent
3
+ Version: 0.0.2
4
+ Summary: Fluent Design for Tkinter
5
+ Author: XiangQinxi
6
+ Author-email: xiangqinxi@outlook.com
7
+ Classifier: Programming Language :: Python :: 2
8
+ Classifier: Programming Language :: Python :: 2.7
9
+ Classifier: Programming Language :: Python :: 3
10
+ Classifier: Programming Language :: Python :: 3.4
11
+ Classifier: Programming Language :: Python :: 3.5
12
+ Classifier: Programming Language :: Python :: 3.6
13
+ Classifier: Programming Language :: Python :: 3.7
14
+ Classifier: Programming Language :: Python :: 3.8
15
+ Classifier: Programming Language :: Python :: 3.9
16
+ Classifier: Programming Language :: Python :: 3.10
17
+ Classifier: Programming Language :: Python :: 3.11
18
+ Classifier: Programming Language :: Python :: 3.12
19
+ Requires-Dist: tkdeft (>=0.0.7,<0.0.8)
20
+ Project-URL: Documentation, https://tkfluent.netlify.app
21
+ Description-Content-Type: text/markdown
22
+
23
+ # tkfluent
@@ -0,0 +1,21 @@
1
+ tkflu/__init__.py,sha256=ZkeXXJhoEwjNUes12oBZHovvKFCuZiaoZj-NCeFvVYg,530
2
+ tkflu/__main__.py,sha256=7qALQjQaw9-cEB_9UhWUuQYZSfh9eONftFx16PlosCE,1317
3
+ tkflu/badge.py,sha256=3Yw5EwlA2UvRLVMK8jdsAv_R6RtrSbC5dQTk9gr2sv4,4882
4
+ tkflu/button.py,sha256=2_XxwkauewTL_Z6YIafJRXAQg8jyrPGhLdRJMaZ1QFY,9987
5
+ tkflu/checkbox.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
6
+ tkflu/customwindow.py,sha256=Fr4CF0vKwj36tYzgX9_5F7OwcD59z9LfOW20Ugm2Hxc,3761
7
+ tkflu/customwindow2.py,sha256=nyNEMoGVnOYXCPbdvxZFUH-VlpAtjjEGI8Ul9VDvgAs,2109
8
+ tkflu/entry.py,sha256=5tQqhGzqwSiRIJQdZz52afDtVAWKKfWNeLgGDzeRXNk,6416
9
+ tkflu/frame.py,sha256=noQhnU-4d6UnvjVMeLYTuS5F-pFBx9-iSJCFXH02B2c,7075
10
+ tkflu/image.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
11
+ tkflu/label.py,sha256=m9HEXlM0ribh8y4B6vfp3HEVH8ElyuVPyG-2BwzdGVo,1598
12
+ tkflu/listbox.py,sha256=gD_oNNWVZtm5qXQ8bVBNRqJL6CGiIYtvhxztM9huzew,9991
13
+ tkflu/litenav.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
14
+ tkflu/scrollbar.py,sha256=1hbu5n1mx4KyiF_M3sohpJJPux1zu5Jlw9V6LfQQs1Y,7293
15
+ tkflu/text.py,sha256=uwpW2omhd6kKQyEVMH-GSSozeMxP3zBUY_RPW5fvuao,6525
16
+ tkflu/thememanager.py,sha256=10Pp4nRyEjdbX4wmh4HayIZomc_iz_vxxSrhIh2SR6s,941
17
+ tkflu/togglebutton.py,sha256=hcAYh8XYaireQuGLHKWxJDLm2wMYHt3GlJnE8TjjbIY,13436
18
+ tkflu/window.py,sha256=pc5M9jIgUj98cFJNR7Q4i3Sll3HxIsDKA8dHL2DxWXg,6581
19
+ tkfluent-0.0.2.dist-info/METADATA,sha256=5UKzRl5OML8VJkXCB1TNd_TB1h5ofkavnxHsDQEhCVM,890
20
+ tkfluent-0.0.2.dist-info/WHEEL,sha256=IrRNNNJ-uuL1ggO5qMvT1GGhQVdQU54d6ZpYqEZfEWo,92
21
+ tkfluent-0.0.2.dist-info/RECORD,,
@@ -1,4 +1,4 @@
1
1
  Wheel-Version: 1.0
2
- Generator: poetry-core 1.8.1
2
+ Generator: poetry-core 1.9.0
3
3
  Root-Is-Purelib: true
4
4
  Tag: py2.py3-none-any
@@ -1,62 +0,0 @@
1
- Metadata-Version: 2.1
2
- Name: tkfluent
3
- Version: 0.0.1
4
- Summary: Fluent Design for Tkinter
5
- Author: XiangQinxi
6
- Author-email: xiangqinxi@outlook.com
7
- Classifier: Programming Language :: Python :: 2
8
- Classifier: Programming Language :: Python :: 2.7
9
- Classifier: Programming Language :: Python :: 3
10
- Classifier: Programming Language :: Python :: 3.4
11
- Classifier: Programming Language :: Python :: 3.5
12
- Classifier: Programming Language :: Python :: 3.6
13
- Classifier: Programming Language :: Python :: 3.7
14
- Classifier: Programming Language :: Python :: 3.8
15
- Classifier: Programming Language :: Python :: 3.9
16
- Classifier: Programming Language :: Python :: 3.10
17
- Classifier: Programming Language :: Python :: 3.11
18
- Classifier: Programming Language :: Python :: 3.12
19
- Requires-Dist: tkdeft (>=0.0.7,<0.0.8)
20
- Project-URL: Documentation, https://tkfluent.netlify.app
21
- Description-Content-Type: text/markdown
22
-
23
- # tkdeft
24
-
25
- [![Netlify Status](https://api.netlify.com/api/v1/badges/c7626ce2-9556-4e4f-b28e-36dc0b513398/deploy-status)](https://app.netlify.com/sites/tkdeft/deploys)
26
-
27
- 意为`灵巧`,灵活轻巧好用
28
-
29
- 继`tkadw`之后的`tkinter`的现代化界面库
30
-
31
- > 开发中
32
-
33
- ---
34
-
35
- ## 原理
36
- 先使用`svgwrite`进行矢量作图(默认会将其存储到临时文件夹中),再用`tksvg`打开图片,将图片利用`Canvas`或`Label`显示出来
37
-
38
- > 这其中还是有些坑的,比如图片不显示等
39
-
40
-
41
- ## 计划
42
- 未来我打算先制作出`SunValley`设计的库然后就去做别的项目
43
-
44
- 设计来源: https://pixso.cn/community/file/ItC5JH1TOwj15EeOPcY7LQ?from_share
45
-
46
- ### 为什么不像tkadw一样做跟易用的主题?
47
- 因为`svg`能实现很多漂亮的组件,而我套的模板可能不对其它设计其太大的作用
48
-
49
- 所以我将这个设计库放在这里当做模板,供其它设计者参考使用。
50
-
51
-
52
- ## 更新日志
53
- ### 2024-01-22
54
- 发布`0.0.1`版本,模板组件包括`DButton`
55
-
56
- ### 2023-01-23
57
- 发布`0.0.2`版本,补充模板组件`DEntry`、`DFrame`、`DText`, `DBadge`
58
-
59
- ### 2023-01-25
60
- 发布`0.0.3` `0.0.4`版本,粗心了,两次补充依赖
61
- 发布`0.0.5`版本,模板组件主题由`theme(mode=..., style=...)`设置,不再使用如`DDarkButton`这样的,添加`DWindow.wincustom`自定义窗口(仅限Windows)
62
- 发布`0.0.6`版本,模板组件`DBadge`补充样式`style=accent`,并对自定义窗口进行稍微调整
@@ -1,13 +0,0 @@
1
- tkflu/__init__.py,sha256=3Sbl4ei-XwAeDyQXm5r6kmRh6nH7sHzDz3NjnVr6GXk,444
2
- tkflu/__main__.py,sha256=qlvG4_dzp62LqQolbwI36slTTE7mtwwZQjRpE4Dalfo,991
3
- tkflu/badge.py,sha256=BBaNbNn_QF6pVhXp3AQSSelJUABPjnqI0fzrLGZZffY,4360
4
- tkflu/button.py,sha256=Y-QoLDoJYCyLsRgkbI78mrL1naKLGKWYBJcuozu0qbI,9914
5
- tkflu/customwindow.py,sha256=Fr4CF0vKwj36tYzgX9_5F7OwcD59z9LfOW20Ugm2Hxc,3761
6
- tkflu/entry.py,sha256=hFjsm52niWypl82HxKz2q6fOJQCQCJ-Om7XCm0Lfyzo,6390
7
- tkflu/frame.py,sha256=GIexJnWpbW40_6_ChWE32xn3Q9jszeJ_Q5JvXVZty7s,6464
8
- tkflu/label.py,sha256=GVr8UtnxvQlWsLLQueIFwkJjPA8RTQ8bScy4orNu2jc,1572
9
- tkflu/text.py,sha256=LEgO6gR2hua6_k6wW6d7lPDNTqTec5i4dTJFcIIejWE,6499
10
- tkflu/window.py,sha256=z9DKaqyMIf-vVPOu39bnANuVEEfwu5LBsYSmIgQ0k2o,4148
11
- tkfluent-0.0.1.dist-info/METADATA,sha256=eDJmuUfo4yUp3j-kWogeRRoD5nzT54MtV0JTVy5Fu_4,2352
12
- tkfluent-0.0.1.dist-info/WHEEL,sha256=5cEDLREhpnNYpDlijc02-Q_4r7AkXMYW6R1JITTLLOQ,92
13
- tkfluent-0.0.1.dist-info/RECORD,,