newtk 0.1.0__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.
- newtk/__init__.py +8 -0
- newtk/newtk.py +52 -0
- newtk-0.1.0.dist-info/METADATA +14 -0
- newtk-0.1.0.dist-info/RECORD +7 -0
- newtk-0.1.0.dist-info/WHEEL +5 -0
- newtk-0.1.0.dist-info/licenses/LICENSE +0 -0
- newtk-0.1.0.dist-info/top_level.txt +1 -0
newtk/__init__.py
ADDED
newtk/newtk.py
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import tkinter as tk
|
|
2
|
+
class Weight():
|
|
3
|
+
def __init__(self,root,bg=None):
|
|
4
|
+
self.root=root
|
|
5
|
+
self.bg=bg
|
|
6
|
+
self.Transparency=0
|
|
7
|
+
self.out=1
|
|
8
|
+
def Fade_in(self):
|
|
9
|
+
self.root.attributes('-alpha',0)
|
|
10
|
+
def use_now():
|
|
11
|
+
if self.Transparency<1.0:
|
|
12
|
+
self.Transparency+=0.01
|
|
13
|
+
self.root.attributes('-alpha',self.Transparency)
|
|
14
|
+
self.root.after(10,use_now)
|
|
15
|
+
elif self.Transparency>=1.0:
|
|
16
|
+
self.Transparency=1.0
|
|
17
|
+
self.root.attributes('-alpha',1)
|
|
18
|
+
use_now()
|
|
19
|
+
def Fade_out(self):
|
|
20
|
+
def see_now():
|
|
21
|
+
if self.out>=0:
|
|
22
|
+
self.out-=0.1
|
|
23
|
+
self.root.attributes('-alpha',self.out)
|
|
24
|
+
self.root.after(10,see_now)
|
|
25
|
+
else:
|
|
26
|
+
self.out=0
|
|
27
|
+
self.root.attributes('-alpha',0)
|
|
28
|
+
self.root.after(200, self.root.destroy)
|
|
29
|
+
see_now()
|
|
30
|
+
class NewButton(Weight):
|
|
31
|
+
def __init__(self,root,text,cmd,bg=None):
|
|
32
|
+
super().__init__(root,bg=bg)
|
|
33
|
+
self.text=text
|
|
34
|
+
self.cmd=cmd
|
|
35
|
+
def use(self):
|
|
36
|
+
self.weight=tk.Label(self.root,text=self.text,bg=self.bg)
|
|
37
|
+
self.weight.bind('<Button-1>',lambda events:self.cmd())
|
|
38
|
+
self.weight.pack()
|
|
39
|
+
def hover(self,hover_bg,leave_bg):
|
|
40
|
+
self.weight.bind('<Enter>',lambda events,c=self.weight:c.config(bg=hover_bg))
|
|
41
|
+
self.weight.bind('<Leave>',lambda events,c=self.weight:c.config(bg=leave_bg))
|
|
42
|
+
def main():
|
|
43
|
+
root=tk.Tk()
|
|
44
|
+
root.title('show')
|
|
45
|
+
root.geometry('300x300')
|
|
46
|
+
Weight(root).Fade_in()
|
|
47
|
+
btn1=NewButton(root,'Hello',lambda:Weight(root).Fade_out(),'red')
|
|
48
|
+
btn1.use()
|
|
49
|
+
btn1.hover('blue','red')
|
|
50
|
+
root.mainloop()
|
|
51
|
+
if __name__=='__main__':
|
|
52
|
+
main()
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: newtk
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: newtk is a modern, lightweight GUI enhancement library for Python's built-in `tkinter`.
|
|
5
|
+
Author-email: cjq <mycjq20111204@outlook.com>
|
|
6
|
+
License: MIT
|
|
7
|
+
Keywords: tkinter,gui,animation,ui,modern,hover-effects
|
|
8
|
+
Requires-Python: >=3.8
|
|
9
|
+
Description-Content-Type: text/markdown
|
|
10
|
+
License-File: LICENSE
|
|
11
|
+
Dynamic: license-file
|
|
12
|
+
|
|
13
|
+
#newtk
|
|
14
|
+
newtk is a modern, lightweight GUI enhancement library for Python's built-in `tkinter`. It is designed to bring sleek animations and interactive effects to your desktop applications with minimal code.
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
newtk/__init__.py,sha256=i0CH-UsGeO_pEgFB2vLRA2YjBlYeV05zgrVt_mreHGo,115
|
|
2
|
+
newtk/newtk.py,sha256=LONwqZIv71rcOAo4EQxeiCIkyxx0fDMAcaldQ2eV0RQ,1773
|
|
3
|
+
newtk-0.1.0.dist-info/licenses/LICENSE,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
4
|
+
newtk-0.1.0.dist-info/METADATA,sha256=gZQclV8LiLCMb8bYKEi4Gm-F3FWGrVXY3ikfDtWPlws,578
|
|
5
|
+
newtk-0.1.0.dist-info/WHEEL,sha256=mOdXR9C3wMVov7cSY8PY-XCzo3SmmWCHvGQr5csJoao,91
|
|
6
|
+
newtk-0.1.0.dist-info/top_level.txt,sha256=27_l6pu6pShpaOMfkKjBpU5qw0fLytfJ12fhA1Me-zU,6
|
|
7
|
+
newtk-0.1.0.dist-info/RECORD,,
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
newtk
|