2022-05-22 21:26:31 +03:00
|
|
|
import customtkinter
|
2021-03-04 20:27:46 +03:00
|
|
|
|
2022-05-30 15:35:33 +03:00
|
|
|
customtkinter.set_appearance_mode("dark") # Modes: "System" (standard), "Dark", "Light"
|
2022-05-22 21:26:31 +03:00
|
|
|
customtkinter.set_default_color_theme("blue") # Themes: "blue" (standard), "green", "dark-blue"
|
2022-01-08 02:29:53 +03:00
|
|
|
|
2022-06-02 00:50:50 +03:00
|
|
|
app = customtkinter.CTk()
|
2022-11-06 16:40:15 +03:00
|
|
|
app.geometry("400x780")
|
2022-05-22 21:26:31 +03:00
|
|
|
app.title("CustomTkinter simple_example.py")
|
2021-03-05 02:32:17 +03:00
|
|
|
|
2022-06-02 00:50:50 +03:00
|
|
|
def button_callback():
|
|
|
|
print("Button click", combobox_1.get())
|
2022-01-07 22:54:45 +03:00
|
|
|
|
2022-12-06 21:29:04 +03:00
|
|
|
|
2022-06-02 00:50:50 +03:00
|
|
|
def slider_callback(value):
|
2022-01-07 22:54:45 +03:00
|
|
|
progressbar_1.set(value)
|
|
|
|
|
|
|
|
|
2022-05-30 15:35:33 +03:00
|
|
|
frame_1 = customtkinter.CTkFrame(master=app)
|
2022-01-23 19:06:34 +03:00
|
|
|
frame_1.pack(pady=20, padx=60, fill="both", expand=True)
|
2022-01-07 22:54:45 +03:00
|
|
|
|
2023-01-21 15:43:18 +03:00
|
|
|
label_1 = customtkinter.CTkLabel(master=frame_1, justify=customtkinter.LEFT)
|
2022-11-06 16:40:15 +03:00
|
|
|
label_1.pack(pady=10, padx=10)
|
2022-01-07 22:54:45 +03:00
|
|
|
|
|
|
|
progressbar_1 = customtkinter.CTkProgressBar(master=frame_1)
|
2022-11-06 16:40:15 +03:00
|
|
|
progressbar_1.pack(pady=10, padx=10)
|
2022-01-07 22:54:45 +03:00
|
|
|
|
2022-06-02 00:50:50 +03:00
|
|
|
button_1 = customtkinter.CTkButton(master=frame_1, command=button_callback)
|
2022-11-06 16:40:15 +03:00
|
|
|
button_1.pack(pady=10, padx=10)
|
2022-01-07 22:54:45 +03:00
|
|
|
|
2022-06-02 00:50:50 +03:00
|
|
|
slider_1 = customtkinter.CTkSlider(master=frame_1, command=slider_callback, from_=0, to=1)
|
2022-11-06 16:40:15 +03:00
|
|
|
slider_1.pack(pady=10, padx=10)
|
2022-01-08 02:29:53 +03:00
|
|
|
slider_1.set(0.5)
|
2022-01-07 22:54:45 +03:00
|
|
|
|
2022-02-04 23:28:37 +03:00
|
|
|
entry_1 = customtkinter.CTkEntry(master=frame_1, placeholder_text="CTkEntry")
|
2022-11-06 16:40:15 +03:00
|
|
|
entry_1.pack(pady=10, padx=10)
|
2022-06-02 00:50:50 +03:00
|
|
|
|
2022-06-15 01:14:35 +03:00
|
|
|
optionmenu_1 = customtkinter.CTkOptionMenu(frame_1, values=["Option 1", "Option 2", "Option 42 long long long..."])
|
2022-11-06 16:40:15 +03:00
|
|
|
optionmenu_1.pack(pady=10, padx=10)
|
2022-05-31 23:32:21 +03:00
|
|
|
optionmenu_1.set("CTkOptionMenu")
|
|
|
|
|
2022-06-15 02:24:02 +03:00
|
|
|
combobox_1 = customtkinter.CTkComboBox(frame_1, values=["Option 1", "Option 2", "Option 42 long long long..."])
|
2022-11-06 16:40:15 +03:00
|
|
|
combobox_1.pack(pady=10, padx=10)
|
2023-01-10 17:03:45 +03:00
|
|
|
combobox_1.set("CTkComboBox")
|
2022-06-02 00:50:50 +03:00
|
|
|
|
2022-05-31 23:32:21 +03:00
|
|
|
checkbox_1 = customtkinter.CTkCheckBox(master=frame_1)
|
2022-11-06 16:40:15 +03:00
|
|
|
checkbox_1.pack(pady=10, padx=10)
|
2022-01-07 22:54:45 +03:00
|
|
|
|
2023-01-21 15:43:18 +03:00
|
|
|
radiobutton_var = customtkinter.IntVar(value=1)
|
2022-03-05 15:05:39 +03:00
|
|
|
|
|
|
|
radiobutton_1 = customtkinter.CTkRadioButton(master=frame_1, variable=radiobutton_var, value=1)
|
2022-11-06 16:40:15 +03:00
|
|
|
radiobutton_1.pack(pady=10, padx=10)
|
2022-03-05 15:05:39 +03:00
|
|
|
|
|
|
|
radiobutton_2 = customtkinter.CTkRadioButton(master=frame_1, variable=radiobutton_var, value=2)
|
2022-11-06 16:40:15 +03:00
|
|
|
radiobutton_2.pack(pady=10, padx=10)
|
2022-03-05 15:05:39 +03:00
|
|
|
|
2022-03-08 17:03:47 +03:00
|
|
|
switch_1 = customtkinter.CTkSwitch(master=frame_1)
|
2022-11-06 16:40:15 +03:00
|
|
|
switch_1.pack(pady=10, padx=10)
|
|
|
|
|
|
|
|
text_1 = customtkinter.CTkTextbox(master=frame_1, width=200, height=70)
|
|
|
|
text_1.pack(pady=10, padx=10)
|
|
|
|
text_1.insert("0.0", "CTkTextbox\n\n\n\n")
|
|
|
|
|
|
|
|
segmented_button_1 = customtkinter.CTkSegmentedButton(master=frame_1, values=["CTkSegmentedButton", "Value 2"])
|
|
|
|
segmented_button_1.pack(pady=10, padx=10)
|
|
|
|
|
|
|
|
tabview_1 = customtkinter.CTkTabview(master=frame_1, width=200, height=70)
|
|
|
|
tabview_1.pack(pady=10, padx=10)
|
|
|
|
tabview_1.add("CTkTabview")
|
|
|
|
tabview_1.add("Tab 2")
|
2022-03-08 17:03:47 +03:00
|
|
|
|
2022-05-22 21:26:31 +03:00
|
|
|
app.mainloop()
|