updated readme

This commit is contained in:
Tom Schimansky 2022-01-08 00:50:31 +01:00
parent daf64a12b4
commit 243bedb8c9
10 changed files with 20 additions and 14 deletions

View File

@ -85,11 +85,7 @@ root_tk = customtkinter.CTk()
... the program ... ... the program ...
root_tk.mainloop() root_tk.mainloop()
``` ```
The above results in a window with a black title-bar with macOS dark-mode turned on:
![](documentation_images/simple_macOS_darkmode_test.png)
If you set the appearance mode to "System", it should change with If you set the appearance mode to "System", it should change with
the System mode: the System mode:
@ -114,6 +110,20 @@ colors and removed the round corners, and added a border to the buttons:
![](documentation_images/complex_example_other_style.png) ![](documentation_images/complex_example_other_style.png)
### Default color themes
If you don't set any colors at all you will get the standard blue
color theme.But you can also change the standard color theme to
green or dark-blue with the following command before you create
the main window:
```python
customtkinter.set_appearance_mode("System")
customtkinter.set_default_color_theme("dark-blue") # Themes: "blue" (standard), "green", "dark-blue"
```
The color themes look like the following in light and dark mode:
![](documentation_images/themes.jpg)
### CustomTkinter on Windows/Linux ### CustomTkinter on Windows/Linux
All elements of Customtkinter are drawn on the ```tkinter.Canvas```. All elements of Customtkinter are drawn on the ```tkinter.Canvas```.
@ -458,6 +468,11 @@ customtkinter.set_appearance_mode("System")
print(customtkinter.get_appearance_mode()) print(customtkinter.get_appearance_mode())
``` ```
Set default color theme:
```python
customtkinter.set_default_color_theme("dark-blue") # Themes: "blue" (standard), "green", "dark-blue"
```
Use macOS darkmode window style without using the `customtkinter.Ctk` class: Use macOS darkmode window style without using the `customtkinter.Ctk` class:
```python ```python
customtkinter.enable_macos_darkmode() # get darkmode window style customtkinter.enable_macos_darkmode() # get darkmode window style

View File

@ -572,4 +572,3 @@ class CTkButton(tkinter.Frame):
self.bg_color = self.master.cget("bg") self.bg_color = self.master.cget("bg")
self.draw() self.draw()
self.update_idletasks()

View File

@ -403,4 +403,3 @@ class CTkCheckBox(tkinter.Frame):
self.bg_color = self.master.cget("bg") self.bg_color = self.master.cget("bg")
self.draw() self.draw()
self.update_idletasks()

View File

@ -40,7 +40,7 @@ class CTkColorManager:
cls.WINDOW_BG = ("#ECECEC", "#323232") # macOS standard light and dark window bg colors cls.WINDOW_BG = ("#ECECEC", "#323232") # macOS standard light and dark window bg colors
cls.MAIN = ("#29B57E", "#29B57E") cls.MAIN = ("#29B57E", "#29B57E")
cls.MAIN_HOVER = ("#6ACBA5", "#6ACBA5") cls.MAIN_HOVER = ("#6ACBA5", "#6ACBA5")
cls.ENTRY = ("#656565", "#222223") cls.ENTRY = ("gray60", "#222223")
cls.TEXT = ("black", "white") cls.TEXT = ("black", "white")
cls.LABEL_BG = ("white", "#626061") cls.LABEL_BG = ("white", "#626061")
cls.SLIDER_BG = ("#636363", "#0D1321") cls.SLIDER_BG = ("#636363", "#0D1321")

View File

@ -210,5 +210,3 @@ class CTkEntry(tkinter.Frame):
self.bg_color = self.master.cget("bg") self.bg_color = self.master.cget("bg")
self.draw() self.draw()
self.update_idletasks()

View File

@ -223,4 +223,3 @@ class CTkLabel(tkinter.Frame):
self.bg_color = self.master.cget("bg") self.bg_color = self.master.cget("bg")
self.draw() self.draw()
self.update_idletasks()

View File

@ -279,4 +279,3 @@ class CTkProgressBar(tkinter.Frame):
self.bg_color = self.master.cget("bg") self.bg_color = self.master.cget("bg")
self.draw() self.draw()
self.update_idletasks()

View File

@ -405,4 +405,3 @@ class CTkSlider(tkinter.Frame):
self.bg_color = self.master.cget("bg") self.bg_color = self.master.cget("bg")
self.draw() self.draw()
self.update_idletasks()

View File

@ -75,7 +75,6 @@ class CTk(tkinter.Tk):
from .customtkinter_button import CTkButton from .customtkinter_button import CTkButton
for child in self.winfo_children(): for child in self.winfo_children():
print("tk change children:", child)
if isinstance(child, (CTkFrame, CTkButton, CTkLabel, CTkSlider, CTkCheckBox, CTkEntry, CTkProgressBar)): if isinstance(child, (CTkFrame, CTkButton, CTkLabel, CTkSlider, CTkCheckBox, CTkEntry, CTkProgressBar)):
child.configure(bg_color=self.fg_color) child.configure(bg_color=self.fg_color)
@ -103,4 +102,3 @@ class CTk(tkinter.Tk):
self.appearance_mode = 0 self.appearance_mode = 0
super().configure(bg=CTkColorManager.single_color(self.fg_color, self.appearance_mode)) super().configure(bg=CTkColorManager.single_color(self.fg_color, self.appearance_mode))
#self.update_idletasks()

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 MiB