-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathplayground.py
111 lines (89 loc) · 3.73 KB
/
playground.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
import tkinter as tk
from tkinter import ttk
from assets.envValues import ENV_VALUES
import ctypes
ctypes.windll.shcore.SetProcessDpiAwareness(1)
root = tk.Tk()
root.columnconfigure(0, weight=1)
TransparencyValue = tk.DoubleVar(value=ENV_VALUES['ALPHA_VALUE'])
# root.config(bg='systemTransparent')
# root.wait_visibility(root)
# root.wm_attributes('-alpha', ENV_VALUES['ALPHA_VALUE'])
# root.wm_attributes('-transparentcolor', root['bg'])
# frames
title_bar_frame = tk.Frame(root)
title_bar_frame.columnconfigure(0, weight=1)
title_bar_frame.grid(row=0, column=0, sticky='EW', pady=(2, 4))
content_frame = tk.Frame(root)
content_frame.columnconfigure(0, weight=1)
content_frame.grid(row=1, column=0, sticky='EW', padx=10, pady=2)
themes_frame = tk.Frame(content_frame, bg='orange')
themes_frame.columnconfigure(0, weight=1,)
themes_frame.columnconfigure(1, weight=1)
themes_frame.columnconfigure(2, weight=1)
themes_frame.columnconfigure(3, weight=1)
themes_frame.grid(row=3, column=0, sticky='EW', pady=10)
# third_frame = tk.Frame(root)
# third_frame.pack(side="top", fill="both", expand=True)
def quit_w():
root.quit()
def changeTransparency(*args):
value = round(TransparencyValue.get(), 1)
ENV_VALUES['ALPHA_VALUE'] = value
root.wm_attributes('-alpha', ENV_VALUES['ALPHA_VALUE'])
def changeTheme(theme_):
print('theme: ', theme_)
# previous action label
title_label = tk.Label(
title_bar_frame,
text='Settings',
font=(ENV_VALUES['FONT_NAME'], 11, 'bold'),
# anchor='w',
)
title_label.grid(
row=0,
column=0,
sticky='W',
padx=(3,0)
)
# quit button
cross_btn_image = tk.PhotoImage(file='./assets/icons/cross/times_solid_20.png')
button_quit = tk.Button(
title_bar_frame,
image=cross_btn_image,
borderwidth=0,
cursor="hand2",
command=quit_w
)
button_quit.grid(
row=0,
column=1,
padx=(0,3)
)
transparency_logo = tk.PhotoImage(file='./assets/icons/cross/adjust-solid.png')
transparency_logo_label = tk.Label(content_frame, image=transparency_logo)
transparency_logo_label.grid(row=0, column=0, sticky='W', padx=(0, 1))
transparency_label = tk.Label(content_frame, text='Transparency')
transparency_label.grid(row=0, column=0, sticky='W', padx=(21, 0))
transparency_slider = ttk.Scale(content_frame, from_=0.3, to=1, orient='horizontal', variable=TransparencyValue, command=changeTransparency)
transparency_slider.grid(row=1, column=0, sticky='EW', pady=(5, 5))
paint_label_logo = tk.PhotoImage(file='./assets/icons/cross/paint-roller-solid.png')
theme_logo_label = tk.Label(content_frame, image=paint_label_logo)
theme_logo_label.grid(row=2, column=0, sticky='W', padx=(0, 1))
theme_label = tk.Label(content_frame, text='Theme')
theme_label.grid(row=2, column=0, sticky='W', padx=(21, 0))
theme_1 = tk.Label(themes_frame, text='Default', bg='#13274F', foreground='white', font=(ENV_VALUES['FONT_NAME'], 9, 'bold'))
theme_1.grid(row=0, column=0, sticky='NEWS', ipady=5)
theme_2 = tk.Label(themes_frame, text='Vanilla', bg='white', foreground='black', font=(ENV_VALUES['FONT_NAME'], 9, 'bold'))
theme_2.grid(row=0, column=1, sticky='NEWS', ipady=5)
theme_3 = tk.Label(themes_frame, text='Hacker', bg='#222222', foreground='#09f62c', font=(ENV_VALUES['FONT_NAME'], 9, 'bold'))
theme_3.grid(row=0, column=2, sticky='NEWS', ipady=5)
theme_4 = tk.Label(themes_frame, text='Invincible', foreground='black', font=(ENV_VALUES['FONT_NAME'], 9, 'bold'))
theme_4.grid(row=0, column=3, sticky='NEWS', ipady=5)
theme_1.bind('<Button>', lambda arg : changeTheme('default'))
theme_2.bind('<Button>', lambda arg : changeTheme('vanilla'))
theme_3.bind('<Button>', lambda arg : changeTheme('hacker'))
theme_4.bind('<Button>', lambda arg : changeTheme('invincible'))
root.overrideredirect(True)
root.geometry('400x180')
root.mainloop()