methods back in wirepy as functions "theme dark and light"
This commit is contained in:
30
wirepy.py
30
wirepy.py
@ -133,6 +133,32 @@ class FrameWidgets(ttk.Frame):
|
||||
with open(set_file, "w", encoding="utf-8") as set_f2:
|
||||
set_f2.writelines(lines2)
|
||||
|
||||
def theme_change_light():
|
||||
"""
|
||||
Set light theme
|
||||
"""
|
||||
if self.tk.call("ttk::style", "theme", "use") == "water-dark":
|
||||
self.tk.call("set_theme", "light")
|
||||
with open(set_file, "r", encoding="utf-8") as theme_set2:
|
||||
lines3 = theme_set2.readlines()
|
||||
lines3[3] = "light\n"
|
||||
with open(set_file, "w", encoding="utf-8") as theme_set2:
|
||||
theme_set2.writelines(lines3)
|
||||
self.color_label()
|
||||
|
||||
def theme_change_dark():
|
||||
"""
|
||||
Set dark theme
|
||||
"""
|
||||
if not self.tk.call("ttk::style", "theme", "use") == "water-dark":
|
||||
self.tk.call("set_theme", "dark")
|
||||
with open(set_file, "r", encoding="utf-8") as theme_set2:
|
||||
lines4 = theme_set2.readlines()
|
||||
lines4[3] = "dark\n"
|
||||
with open(set_file, "w", encoding="utf-8") as theme_set2:
|
||||
theme_set2.writelines(lines4)
|
||||
self.color_label()
|
||||
|
||||
def tooltip():
|
||||
"""
|
||||
Set True or False in file
|
||||
@ -197,8 +223,8 @@ class FrameWidgets(ttk.Frame):
|
||||
self.settings.add_checkbutton(
|
||||
label=_("Disable Tooltips"), command=tooltip, variable=set_tip
|
||||
)
|
||||
self.settings.add_command(label=_("Light"), command=lambda: LxTools.theme_change_light(self, set_file))
|
||||
self.settings.add_command(label=_("Dark"), command=lambda: LxTools.theme_change_dark(self, set_file))
|
||||
self.settings.add_command(label=_("Light"), command=theme_change_light)
|
||||
self.settings.add_command(label=_("Dark"), command=theme_change_dark)
|
||||
|
||||
# About BTN Menu / Label
|
||||
self.about_btn = ttk.Button(
|
||||
|
Reference in New Issue
Block a user