mirror of
https://github.com/TomSchimansky/CustomTkinter.git
synced 2023-08-10 21:13:13 +03:00
readme wiki
This commit is contained in:
parent
a7f5e92d51
commit
c4dec82f2f
@ -12,12 +12,12 @@ which can either be set manually or get controlled by
|
|||||||
the system appearance mode (only macOS).
|
the system appearance mode (only macOS).
|
||||||
|
|
||||||
### Example program (simple button):
|
### Example program (simple button):
|
||||||
|
To use CustomTkinter, just place the /customtkinter folder from this repository
|
||||||
|
next to your program, and then you can do `import customtkinter`.
|
||||||
```python
|
```python
|
||||||
import tkinter
|
import tkinter
|
||||||
import customtkinter # <- import the CustomTkinter module
|
import customtkinter # <- import the CustomTkinter module
|
||||||
|
|
||||||
customtkinter.set_appearance_mode("Light") # Other: "Dark", "System" (only macOS)
|
|
||||||
|
|
||||||
root_tk = tkinter.Tk() # create the Tk window like you normally do
|
root_tk = tkinter.Tk() # create the Tk window like you normally do
|
||||||
root_tk.geometry("400x240")
|
root_tk.geometry("400x240")
|
||||||
root_tk.title("CustomTkinter Test")
|
root_tk.title("CustomTkinter Test")
|
||||||
@ -43,6 +43,8 @@ If you specify custom colors for CustomTkinter elements, the you can either use
|
|||||||
tuple in the form: (light_color, dark_color). Or you can set a single color
|
tuple in the form: (light_color, dark_color). Or you can set a single color
|
||||||
which will be used in light and dark theme.
|
which will be used in light and dark theme.
|
||||||
```python
|
```python
|
||||||
|
customtkinter.set_appearance_mode("Dark") # Other: "Light", "System" (only macOS)
|
||||||
|
|
||||||
button = customtkinter.CTkButton(master=root_tk,
|
button = customtkinter.CTkButton(master=root_tk,
|
||||||
fg_color=("black", "lightgray"), # <- tuple color for light and dark theme
|
fg_color=("black", "lightgray"), # <- tuple color for light and dark theme
|
||||||
text="CTkButton",
|
text="CTkButton",
|
||||||
|
@ -42,7 +42,8 @@
|
|||||||
import tkinter
|
import tkinter
|
||||||
import customtkinter
|
import customtkinter
|
||||||
|
|
||||||
customtkinter.enable_macos_darkmode()
|
# customtkinter.enable_macos_darkmode()
|
||||||
|
customtkinter.set_appearance_mode("light")
|
||||||
|
|
||||||
root_tk = tkinter.Tk()
|
root_tk = tkinter.Tk()
|
||||||
root_tk.geometry("250x150")
|
root_tk.geometry("250x150")
|
||||||
@ -55,3 +56,4 @@ button = customtkinter.CTkButton(master=root_tk, corner_radius=10, command=butto
|
|||||||
button.place(relx=0.5, rely=0.5, anchor=tkinter.CENTER)
|
button.place(relx=0.5, rely=0.5, anchor=tkinter.CENTER)
|
||||||
|
|
||||||
root_tk.mainloop()
|
root_tk.mainloop()
|
||||||
|
customtkinter.disable_macos_darkmode()
|
Loading…
Reference in New Issue
Block a user