added CTk class which overrides tkinter.Tk for automatic background color changes

This commit is contained in:
Tom Schimansky
2021-12-31 19:07:53 +01:00
parent afc177ddbb
commit 063c1f8b6a
10 changed files with 84 additions and 40 deletions

View File

@ -9,16 +9,14 @@ customtkinter.set_appearance_mode("Dark") # Other: "Light", "System"
PATH = os.path.dirname(os.path.realpath(__file__))
class App(tkinter.Tk):
class App(customtkinter.CTk):
APP_NAME = "CustomTkinter background gardient"
WIDTH = 900
HEIGHT = 600
def __init__(self, *args, **kwargs):
customtkinter.enable_macos_darkmode()
tkinter.Tk.__init__(self, *args, **kwargs)
super().__init__(self, *args, **kwargs)
self.title(App.APP_NAME)
self.geometry(str(App.WIDTH) + "x" + str(App.HEIGHT))
@ -54,7 +52,6 @@ class App(tkinter.Tk):
print("Button pressed")
def on_closing(self, event=0):
customtkinter.disable_macos_darkmode()
self.destroy()
def start(self):