-
Notifications
You must be signed in to change notification settings - Fork 1.1k
CTk (tkinter.Tk)
Tom Schimansky edited this page Jul 5, 2022
·
18 revisions
Theoretically you could also use the normal tkinter.Tk
class to create a window and place CTK widgets on it,
but it is highly recommended to use the customtkinter.CTk
to create the window if you use CustomTkinter.
Because only with the CTk
window you get a dark window background and header which adapts to the dark/light mode
set by customtkinter.set_appearance_mode(...)
.
Apart from the changing background and header color, the CTk
class behaves exactly like the tkinter.Tk
class.
root_tk = customtkinter.CTk()
root_tk.geometry(f"{600}x{500}")
root_tk.title("CTk example")
... program ...
root_tk.mainloop()
class App(customtkinter.CTk)
def __init__(self):
super().__init__()
self.geometry(f"{600}x{500}")
self.title("CTk example")
... create widgets ...
... program methods ...
app = App()
app.mainloop()
argument | value |
---|---|
bg_color or bg | tuple: (light_color, dark_color) or single color |
and all arguments from tkinter.Tk
root_tk = customtkinter.CTk()
# configure bg color with single or tuple color
root_tk.configure(bg_color="gray20")
root_tk.configure(bg_color=(<light-mode color>, <dark-mode color>))
and all methods from tkinter.Tk
CustomTkinter by Tom Schimansky 2022
The Github Wiki is outdated, the new documentation can be found at: