├── Widgets ├── Button │ ├── message_icon.png │ └── main.py ├── Switch │ └── main.py ├── Label │ └── main.py ├── Entry │ └── main.py ├── Slider │ └── main.py ├── Textbox │ └── main.py ├── Checkbox │ └── main.py └── Combobox │ └── main.py ├── Event Handling ├── Click Handling │ └── main.py ├── Change Handling │ └── main.py ├── Using Get │ └── main.py └── Configure Widget Properties │ └── main.py ├── Frames and Tabs ├── Frame │ ├── main.py │ └── frame_example.py ├── Tabs │ └── main.py └── ScrollableFrame │ └── main.py └── Color Themes └── main.py /Widgets/Button/message_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RoyChng/customtkinter-tutorial/HEAD/Widgets/Button/message_icon.png -------------------------------------------------------------------------------- /Widgets/Switch/main.py: -------------------------------------------------------------------------------- 1 | from customtkinter import * 2 | 3 | app = CTk() 4 | app.geometry("500x400") 5 | 6 | switch = CTkSwitch(master=app, text="Option") 7 | 8 | switch.place(relx=0.5, rely=0.5, anchor="center") 9 | 10 | 11 | app.mainloop() -------------------------------------------------------------------------------- /Widgets/Label/main.py: -------------------------------------------------------------------------------- 1 | from customtkinter import * 2 | 3 | app = CTk() 4 | app.geometry("500x400") 5 | 6 | label = CTkLabel(master=app, text="Some Text...", font=("Arial", 20), text_color="#FFCC70") 7 | 8 | label.place(relx=0.5, rely=0.5, anchor="center") 9 | 10 | 11 | app.mainloop() -------------------------------------------------------------------------------- /Widgets/Entry/main.py: -------------------------------------------------------------------------------- 1 | from customtkinter import * 2 | 3 | app = CTk() 4 | app.geometry("500x400") 5 | 6 | entry = CTkEntry(master=app, placeholder_text="Start typing...", width=300, 7 | text_color="#FFCC70") 8 | 9 | entry.place(relx=0.5, rely=0.5, anchor="center") 10 | 11 | 12 | app.mainloop() -------------------------------------------------------------------------------- /Widgets/Slider/main.py: -------------------------------------------------------------------------------- 1 | from customtkinter import * 2 | 3 | app = CTk() 4 | app.geometry("500x400") 5 | 6 | slider = CTkSlider(master=app, from_=0, to=100, number_of_steps=5, 7 | button_color="#C850C0", orientation="vertical") 8 | 9 | slider.place(relx=0.5, rely=0.5, anchor="center") 10 | 11 | 12 | app.mainloop() -------------------------------------------------------------------------------- /Event Handling/Click Handling/main.py: -------------------------------------------------------------------------------- 1 | from customtkinter import * 2 | 3 | app = CTk() 4 | app.geometry("500x400") 5 | 6 | def click_handler(): 7 | print("Button Clicked") 8 | 9 | 10 | btn = CTkButton(master=app, text="Click Me", command=click_handler) 11 | 12 | btn.place(relx=0.5, rely=0.5, anchor="center") 13 | 14 | 15 | app.mainloop() -------------------------------------------------------------------------------- /Widgets/Textbox/main.py: -------------------------------------------------------------------------------- 1 | from customtkinter import * 2 | 3 | app = CTk() 4 | app.geometry("500x400") 5 | 6 | textbox = CTkTextbox(master=app, scrollbar_button_color="#FFCC70", corner_radius=16, 7 | border_color="#FFCC70", border_width=2) 8 | 9 | textbox.place(relx=0.5, rely=0.5, anchor="center") 10 | 11 | 12 | app.mainloop() -------------------------------------------------------------------------------- /Widgets/Checkbox/main.py: -------------------------------------------------------------------------------- 1 | from customtkinter import * 2 | 3 | app = CTk() 4 | app.geometry("500x400") 5 | 6 | checkbox = CTkCheckBox(master=app, text="Option", fg_color="#C850C0", checkbox_height=30, 7 | checkbox_width=30, corner_radius=36) 8 | 9 | checkbox.place(relx=0.5, rely=0.5, anchor="center") 10 | 11 | 12 | app.mainloop() -------------------------------------------------------------------------------- /Event Handling/Change Handling/main.py: -------------------------------------------------------------------------------- 1 | from customtkinter import * 2 | 3 | app = CTk() 4 | app.geometry("500x400") 5 | 6 | def change_handler(value): 7 | print(f"Selected Value {value}") 8 | 9 | 10 | btn = CTkSlider(master=app, from_=0, to=100, command=change_handler) 11 | 12 | btn.place(relx=0.5, rely=0.5, anchor="center") 13 | 14 | 15 | app.mainloop() -------------------------------------------------------------------------------- /Widgets/Combobox/main.py: -------------------------------------------------------------------------------- 1 | from customtkinter import * 2 | 3 | app = CTk() 4 | app.geometry("500x400") 5 | 6 | combobox = CTkComboBox(master=app, values=["option 1", "option 2", "option 3"], fg_color="#0093E9", 7 | border_color="#FBAB7E", dropdown_fg_color="#0093E9") 8 | 9 | combobox.place(relx=0.5, rely=0.5, anchor="center") 10 | 11 | 12 | app.mainloop() -------------------------------------------------------------------------------- /Event Handling/Using Get/main.py: -------------------------------------------------------------------------------- 1 | from customtkinter import * 2 | 3 | app = CTk() 4 | app.geometry("500x400") 5 | 6 | 7 | def click_handler(): 8 | print(f"Entered Value: {entry.get()}") 9 | 10 | 11 | entry = CTkEntry(master=app, placeholder_text="Type anything...") 12 | btn = CTkButton(master=app, text="Submit", command=click_handler) 13 | 14 | entry.pack(anchor="s", expand=True, pady=10) 15 | btn.pack(anchor="n", expand=True,) 16 | 17 | app.mainloop() -------------------------------------------------------------------------------- /Widgets/Button/main.py: -------------------------------------------------------------------------------- 1 | from customtkinter import * 2 | from PIL import Image 3 | 4 | app = CTk() 5 | app.geometry("500x400") 6 | 7 | set_appearance_mode("dark") 8 | 9 | img = Image.open("message_icon.png") 10 | 11 | btn = CTkButton(master=app, text="Click Me", corner_radius=32, fg_color="#4158D0", 12 | hover_color="#C850C0", border_color="#FFCC70", 13 | border_width=2, image=CTkImage(dark_image=img, light_image=img)) 14 | 15 | 16 | btn.place(relx=0.5, rely=0.5, anchor="center") 17 | 18 | 19 | app.mainloop() -------------------------------------------------------------------------------- /Event Handling/Configure Widget Properties/main.py: -------------------------------------------------------------------------------- 1 | from customtkinter import * 2 | 3 | app = CTk() 4 | app.geometry("500x400") 5 | 6 | count = 0 7 | 8 | def click_handler(): 9 | global count 10 | count += 1 11 | label.configure(text=f"You've clicked the button {count} times") 12 | 13 | 14 | label = CTkLabel(master=app, text="You've clicked the button 0 times") 15 | btn = CTkButton(master=app, text="Click Me", command=click_handler) 16 | 17 | label.pack(anchor="s", expand=True, pady=10) 18 | btn.pack(anchor="n", expand=True,) 19 | 20 | app.mainloop() -------------------------------------------------------------------------------- /Frames and Tabs/Frame/main.py: -------------------------------------------------------------------------------- 1 | from customtkinter import * 2 | 3 | app = CTk() 4 | app.geometry("500x400") 5 | 6 | 7 | frame = CTkFrame(master=app, fg_color="#8D6F3A", border_color="#FFCC70", border_width=2) 8 | frame.pack(expand=True) 9 | 10 | label = CTkLabel(master=frame, text="This is a frame") 11 | entry = CTkEntry(master=frame, placeholder_text="Type something...") 12 | btn = CTkButton(master=frame, text="Submit") 13 | 14 | 15 | label.pack(anchor="s", expand=True, pady=10, padx=30) 16 | entry.pack(anchor="s", expand=True, pady=10, padx=30) 17 | btn.pack(anchor="n", expand=True, padx=30, pady=20) 18 | 19 | app.mainloop() -------------------------------------------------------------------------------- /Frames and Tabs/Tabs/main.py: -------------------------------------------------------------------------------- 1 | from customtkinter import * 2 | 3 | app = CTk() 4 | app.geometry("500x400") 5 | 6 | 7 | tabview = CTkTabview(master=app) 8 | tabview.pack(padx=20, pady=20) 9 | 10 | tabview.add("Tab 1") 11 | tabview.add("Tab 2") 12 | tabview.add("Tab 3") 13 | 14 | label_1 = CTkLabel(master=tabview.tab("Tab 1"), text="This is tab 1") 15 | label_1.pack(padx=20, pady=20) 16 | 17 | label_2 = CTkLabel(master=tabview.tab("Tab 2"), text="This is tab 2") 18 | label_2.pack(padx=20, pady=20) 19 | 20 | label_3 = CTkLabel(master=tabview.tab("Tab 3"), text="This is tab 3") 21 | label_3.pack(padx=20, pady=20) 22 | 23 | app.mainloop() -------------------------------------------------------------------------------- /Color Themes/main.py: -------------------------------------------------------------------------------- 1 | from customtkinter import * 2 | 3 | app = CTk() 4 | app.geometry("500x400") 5 | 6 | set_default_color_theme("green") 7 | 8 | CTkButton(master=app, text="Button").pack(pady=20, padx=20) 9 | CTkCheckBox(master=app, text="Check box").pack(pady=20, padx=20) 10 | CTkComboBox(master=app, values=["Option 1", "Option 2", "Option 3"]).pack(pady=20, padx=20) 11 | CTkEntry(master=app, placeholder_text="Start typing...").pack(pady=20, padx=20) 12 | CTkProgressBar(master=app).pack(pady=20, padx=20) 13 | CTkRadioButton(master=app, text="Radio button").pack(pady=20, padx=20) 14 | CTkSlider(master=app).pack(pady=20, padx=20) 15 | CTkSwitch(master=app, text="Option").pack(pady=20, padx=20) 16 | 17 | app.mainloop() -------------------------------------------------------------------------------- /Frames and Tabs/ScrollableFrame/main.py: -------------------------------------------------------------------------------- 1 | from customtkinter import * 2 | 3 | app = CTk() 4 | app.geometry("500x400") 5 | 6 | 7 | frame = CTkScrollableFrame(master=app, fg_color="#8D6F3A", border_color="#FFCC70", border_width=2, 8 | orientation="vertical", scrollbar_button_color="#FFCC70") 9 | frame.pack(expand=True) 10 | 11 | label = CTkLabel(master=frame, text="This is a frame") 12 | entry = CTkEntry(master=frame, placeholder_text="Type something...") 13 | btn = CTkButton(master=frame, text="Submit") 14 | 15 | 16 | label.pack(anchor="s", expand=True, pady=10, padx=30) 17 | entry.pack(anchor="s", expand=True, pady=10, padx=30) 18 | btn.pack(anchor="n", expand=True, padx=30, pady=20) 19 | CTkButton(master=frame, text="Another Widget").pack(expand=True, padx=30, pady=20) 20 | CTkButton(master=frame, text="Another Widget").pack(expand=True, padx=30, pady=20) 21 | CTkButton(master=frame, text="Another Widget").pack(expand=True, padx=30, pady=20) 22 | CTkButton(master=frame, text="Another Widget").pack(expand=True, padx=30, pady=20) 23 | CTkButton(master=frame, text="Another Widget").pack(expand=True, padx=30, pady=20) 24 | 25 | app.mainloop() -------------------------------------------------------------------------------- /Frames and Tabs/Frame/frame_example.py: -------------------------------------------------------------------------------- 1 | from customtkinter import * 2 | 3 | app = CTk() 4 | app.geometry("900x600") 5 | 6 | frame_2 = CTkFrame(master=app, fg_color="#606190") 7 | frame_2.grid(row=0, column=1, padx=50, pady=50) 8 | 9 | CTkLabel(master=frame_2, text="Section 2", font=("Arial Bold", 20), justify="left").pack(expand=True, pady=(30, 15)) 10 | CTkRadioButton(master=frame_2, text="Setting 1", fg_color="#ffffff", border_color="#ffffff").pack(expand=True, side="left", padx=20, pady=(20, 50)) 11 | CTkRadioButton(master=frame_2, text="Setting 2", fg_color="#ffffff", border_color="#ffffff").pack(expand=True, side="left", padx=20, pady=(20, 50)) 12 | CTkRadioButton(master=frame_2, text="Setting 3", fg_color="#ffffff", border_color="#ffffff").pack(expand=True, side="left", padx=20, pady=(20, 50)) 13 | 14 | frame_3 = CTkFrame(master=app, fg_color="#4EAC7D") 15 | frame_3.grid(row=1, column=1) 16 | 17 | CTkLabel(master=frame_3, text="Section 3", font=("Arial Bold", 20), justify="left").pack(expand=True, pady=(30, 15)) 18 | CTkEntry(master=frame_3, placeholder_text="Enter your username", width=400).pack(expand=True, pady=15, padx=20) 19 | CTkEntry(master=frame_3, placeholder_text="Enter your password", width=400).pack(expand=True, pady=15, padx=20) 20 | CTkButton(master=frame_3, text="Login").pack(expand=True, fill="both", pady=(30, 15), padx=30) 21 | 22 | 23 | frame_1 = CTkScrollableFrame(master=app, fg_color="#CD8C67") 24 | frame_1.grid(row=0, column=0, rowspan=2, sticky="nsew", padx=50, pady=50) 25 | 26 | CTkLabel(master=frame_1, text="Section 1", font=("Arial Bold", 20), justify="left").pack(expand=True, pady=[10, 30]) 27 | CTkCheckBox(master=frame_1, text="Option 1", border_color="#ffffff", fg_color="#ffffff", checkmark_color="#CD8C67").pack(expand=True, pady=20) 28 | CTkCheckBox(master=frame_1, text="Option 2", border_color="#ffffff", fg_color="#ffffff", checkmark_color="#CD8C67").pack(expand=True, pady=20) 29 | CTkCheckBox(master=frame_1, text="Option 3", border_color="#ffffff", fg_color="#ffffff", checkmark_color="#CD8C67").pack(expand=True, pady=20) 30 | CTkCheckBox(master=frame_1, text="Option 4", border_color="#ffffff", fg_color="#ffffff", checkmark_color="#CD8C67").pack(expand=True, pady=20) 31 | CTkCheckBox(master=frame_1, text="Option 5", border_color="#ffffff", fg_color="#ffffff", checkmark_color="#CD8C67").pack(expand=True, pady=20) 32 | CTkCheckBox(master=frame_1, text="Option 6", border_color="#ffffff", fg_color="#ffffff", checkmark_color="#CD8C67").pack(expand=True, pady=20) 33 | CTkCheckBox(master=frame_1, text="Option 7", border_color="#ffffff", fg_color="#ffffff", checkmark_color="#CD8C67").pack(expand=True, pady=20) 34 | 35 | 36 | app.mainloop() --------------------------------------------------------------------------------