diff --git a/Readme.md b/Readme.md index a2fed76..38af856 100644 --- a/Readme.md +++ b/Readme.md @@ -14,23 +14,36 @@ the system appearance mode (only macOS). ### Example program (simple button): ```python import tkinter -import customtkinter +import customtkinter # <- import the CustomTkinter module -root_tk = tkinter.Tk() +customtkinter.set_appearance_mode("Light") # Other: "Dark", "System" (only macOS) + +root_tk = tkinter.Tk() # create the Tk window like you normally do root_tk.geometry("400x240") root_tk.title("CustomTkinter Test") def button_function(): print("button pressed") +# Use CTkButton instead of tkinter Button button = customtkinter.CTkButton(master=root_tk, corner_radius=10, command=button_function) button.place(relx=0.5, rely=0.5, anchor=tkinter.CENTER) root_tk.mainloop() ``` which gives the following: + ![](documentation_images/simple_button_test.png) +### Use custom colors and shapes: +If you dont specify any colors, customtkinter uses the standard blue color in the light theme. +You can change the color theme to dark by calling +```customtkinter.set_appearance_mode("Dark")```. +If you specify custom colors for CustomTkinter elements, the you can either use a +tuple in the form: (light_color, dark_color). Or you can set a single color +which will be used in light and dark theme. + + ### How to use macOS dark mode? If you have a python version with Tcl/Tk >= 8.6.9, then you can enable the macOS darkmode. Currently only the anaconda python versions have Tcl/Tk >= 8.6.9. @@ -45,6 +58,10 @@ customtkinter.set_appearance_mode("System") customtkinter.disable_macos_darkmode() ``` +which gives the following with the above simple button program: + +![](documentation_images/simple_macOS_darkmode_test.png) + ## Ui-Elements diff --git a/customtkinter/customtkinter_color_manager.py b/customtkinter/customtkinter_color_manager.py index cd8603f..fe11d2b 100644 --- a/customtkinter/customtkinter_color_manager.py +++ b/customtkinter/customtkinter_color_manager.py @@ -1,3 +1,4 @@ +import sys class CTkColorManager: @@ -25,5 +26,5 @@ class CTkColorManager: elif main_color.lower() == "blue": cls.set_theme_color("#1C94CF", "#5FB4DD") - elif main_color.lower() == "blue": - cls.set_theme_color("#1C94CF", "#5FB4DD") + else: + sys.stderr.write("WARNING (CTkColorManager): No such color theme available: {}\n".format(main_color)) diff --git a/documentation_images/simple_button_test.png b/documentation_images/simple_button_test.png index e4d7606..b3e0d21 100644 Binary files a/documentation_images/simple_button_test.png and b/documentation_images/simple_button_test.png differ diff --git a/documentation_images/simple_macOS_darkmode_test.png b/documentation_images/simple_macOS_darkmode_test.png new file mode 100644 index 0000000..c9ed78e Binary files /dev/null and b/documentation_images/simple_macOS_darkmode_test.png differ diff --git a/simple_test.py b/simple_test.py index d58b334..122b119 100644 --- a/simple_test.py +++ b/simple_test.py @@ -42,6 +42,8 @@ import tkinter import customtkinter +customtkinter.enable_macos_darkmode() + root_tk = tkinter.Tk() root_tk.geometry("250x150") root_tk.title("CustomTkinter Test")