Skip to content

Commit a14df7a

Browse files
committed
Add chenge theme feature
1 parent 230a99f commit a14df7a

File tree

1 file changed

+21
-8
lines changed

1 file changed

+21
-8
lines changed

scripts/main.py

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,30 @@ def Arduino(porta):
1414

1515

1616
def changeTheme():
17-
global color_bg, color_text
17+
global color_bg, color_text, instagram_link, github_link, text_radius_color
1818
if ctk.get_appearance_mode() == "Dark":
1919
ctk.set_appearance_mode("light")
2020
color_bg = "#DBDBDB"
2121
color_text = "purple"
22+
text_radius_color = "#EBEBEB"
23+
instagram_link = ctk.CTkLabel(root, text="Instagram", text_color=color_text, cursor="hand2",
24+
fg_color=text_radius_color, bg_color=color_bg, corner_radius=20)
25+
github_link = ctk.CTkLabel(root, text="GitHub", text_color=color_text, cursor="hand2",
26+
fg_color=text_radius_color, bg_color=color_bg, corner_radius=20)
27+
instagram_link.place(x=20, y=root.winfo_height() - 80)
28+
github_link.place(x=20, y=root.winfo_height() - 50)
2229
open_new_page()
2330
else:
2431
ctk.set_appearance_mode("Dark")
2532
color_bg = "#2B2B2B"
2633
color_text = "magenta"
34+
text_radius_color = "#242424"
35+
instagram_link = ctk.CTkLabel(root, text="Instagram", text_color=color_text, cursor="hand2",
36+
fg_color=text_radius_color, corner_radius=20)
37+
github_link = ctk.CTkLabel(root, text="GitHub", text_color=color_text, cursor="hand2",
38+
fg_color=text_radius_color, corner_radius=20)
39+
instagram_link.place(x=20, y=root.winfo_height() - 80)
40+
github_link.place(x=20, y=root.winfo_height() - 50)
2741
open_new_page()
2842

2943

@@ -114,15 +128,15 @@ def open_new_page():
114128
wraplength=400)
115129
about_label.pack()
116130
instagram_link = ctk.CTkLabel(root, text="Instagram", text_color=color_text, cursor="hand2",
117-
fg_color=color_bg, bg_color=color_bg, corner_radius=20)
118-
github_link = ctk.CTkLabel(root, text="GitHub", text_color=color_text, cursor="hand2", fg_color=color_bg,
131+
fg_color=text_radius_color, bg_color=color_bg, corner_radius=20)
132+
github_link = ctk.CTkLabel(root, text="GitHub", text_color=color_text, cursor="hand2", fg_color=text_radius_color,
119133
bg_color=color_bg, corner_radius=20)
120134

121135
instagram_link.bind("<Button-1>", lambda e: callback("https://www.instagram.com/veras_programmer"))
122136
github_link.bind("<Button-1>", lambda e: callback("https://www.github.com/Veras-D"))
123137

124-
instagram_link.place(x=20, y=root.winfo_height()-70)
125-
github_link.place(x=20, y=root.winfo_height()-45)
138+
instagram_link.place(x=20, y=root.winfo_height()-80)
139+
github_link.place(x=20, y=root.winfo_height()-50)
126140

127141
else:
128142
port_error = ctk.CTkToplevel(root)
@@ -221,15 +235,14 @@ def led_pulse():
221235

222236
color_bg = "#2B2B2B"
223237
color_text = "magenta"
238+
text_radius_color = "#242424"
224239
ports = find_arduino()
225240
root = ctk.CTk()
226241
root.title("PyHolofotes")
227242
root.update()
228243
root.geometry(f"300x120+{CENTER}+{CENTER}")
229244
root.resizable(False, False)
230245
ctk.set_appearance_mode("dark")
231-
# icon = get_base64_encoded_image("../img/icon.png")
232-
# root.iconphoto(True, PhotoImage(data=icon))
233246
frame(root)
234247

235248

@@ -243,7 +256,7 @@ def led_pulse():
243256
dropdown.pack(pady=5)
244257

245258

246-
button = ctk.CTkButton(root, text="Continuar", command=open_new_page, fg_color="purple", hover_color="#8B008B")
259+
button = ctk.CTkButton(root, text="Continue", command=open_new_page, fg_color="purple", hover_color="#8B008B")
247260
button.pack(pady=25)
248261

249262
porta = selected_port.get()

0 commit comments

Comments
 (0)