Skip to content

Commit

Permalink
Add chenge theme feature
Browse files Browse the repository at this point in the history
  • Loading branch information
Veras-D committed Dec 31, 2023
1 parent 230a99f commit a14df7a
Showing 1 changed file with 21 additions and 8 deletions.
29 changes: 21 additions & 8 deletions scripts/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,30 @@ def Arduino(porta):


def changeTheme():
global color_bg, color_text
global color_bg, color_text, instagram_link, github_link, text_radius_color
if ctk.get_appearance_mode() == "Dark":
ctk.set_appearance_mode("light")
color_bg = "#DBDBDB"
color_text = "purple"
text_radius_color = "#EBEBEB"
instagram_link = ctk.CTkLabel(root, text="Instagram", text_color=color_text, cursor="hand2",
fg_color=text_radius_color, bg_color=color_bg, corner_radius=20)
github_link = ctk.CTkLabel(root, text="GitHub", text_color=color_text, cursor="hand2",
fg_color=text_radius_color, bg_color=color_bg, corner_radius=20)
instagram_link.place(x=20, y=root.winfo_height() - 80)
github_link.place(x=20, y=root.winfo_height() - 50)
open_new_page()
else:
ctk.set_appearance_mode("Dark")
color_bg = "#2B2B2B"
color_text = "magenta"
text_radius_color = "#242424"
instagram_link = ctk.CTkLabel(root, text="Instagram", text_color=color_text, cursor="hand2",
fg_color=text_radius_color, corner_radius=20)
github_link = ctk.CTkLabel(root, text="GitHub", text_color=color_text, cursor="hand2",
fg_color=text_radius_color, corner_radius=20)
instagram_link.place(x=20, y=root.winfo_height() - 80)
github_link.place(x=20, y=root.winfo_height() - 50)
open_new_page()


Expand Down Expand Up @@ -114,15 +128,15 @@ def open_new_page():
wraplength=400)
about_label.pack()
instagram_link = ctk.CTkLabel(root, text="Instagram", text_color=color_text, cursor="hand2",
fg_color=color_bg, bg_color=color_bg, corner_radius=20)
github_link = ctk.CTkLabel(root, text="GitHub", text_color=color_text, cursor="hand2", fg_color=color_bg,
fg_color=text_radius_color, bg_color=color_bg, corner_radius=20)
github_link = ctk.CTkLabel(root, text="GitHub", text_color=color_text, cursor="hand2", fg_color=text_radius_color,
bg_color=color_bg, corner_radius=20)

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

instagram_link.place(x=20, y=root.winfo_height()-70)
github_link.place(x=20, y=root.winfo_height()-45)
instagram_link.place(x=20, y=root.winfo_height()-80)
github_link.place(x=20, y=root.winfo_height()-50)

else:
port_error = ctk.CTkToplevel(root)
Expand Down Expand Up @@ -221,15 +235,14 @@ def led_pulse():

color_bg = "#2B2B2B"
color_text = "magenta"
text_radius_color = "#242424"
ports = find_arduino()
root = ctk.CTk()
root.title("PyHolofotes")
root.update()
root.geometry(f"300x120+{CENTER}+{CENTER}")
root.resizable(False, False)
ctk.set_appearance_mode("dark")
# icon = get_base64_encoded_image("../img/icon.png")
# root.iconphoto(True, PhotoImage(data=icon))
frame(root)


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


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

porta = selected_port.get()
Expand Down

0 comments on commit a14df7a

Please sign in to comment.