Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
loeasy68
GitHub Repository: loeasy68/loeasy68.github.io
Path: blob/main/Business/Desktop/example.py
2940 views
1
import tkinter
2
import customtkinter
3
4
customtkinter.set_appearance_mode("dark") # Modes: "System" (standard), "Dark", "Light"
5
customtkinter.set_default_color_theme("blue") # Themes: "blue" (standard), "green", "dark-blue"
6
7
app = customtkinter.CTk()
8
app.geometry("400x580")
9
app.title("CustomTkinter simple_example.py")
10
11
12
def button_callback():
13
print("Button click", combobox_1.get())
14
15
16
def slider_callback(value):
17
progressbar_1.set(value)
18
19
20
frame_1 = customtkinter.CTkFrame(master=app)
21
frame_1.pack(pady=20, padx=60, fill="both", expand=True)
22
23
label_1 = customtkinter.CTkLabel(master=frame_1, justify=tkinter.LEFT)
24
label_1.pack(pady=12, padx=10)
25
26
progressbar_1 = customtkinter.CTkProgressBar(master=frame_1)
27
progressbar_1.pack(pady=12, padx=10)
28
29
button_1 = customtkinter.CTkButton(master=frame_1, command=button_callback)
30
button_1.pack(pady=12, padx=10)
31
32
slider_1 = customtkinter.CTkSlider(master=frame_1, command=slider_callback, from_=0, to=1)
33
slider_1.pack(pady=12, padx=10)
34
slider_1.set(0.5)
35
36
entry_1 = customtkinter.CTkEntry(master=frame_1, placeholder_text="CTkEntry")
37
entry_1.pack(pady=12, padx=10)
38
39
optionmenu_1 = customtkinter.CTkOptionMenu(frame_1, values=["Option 1", "Option 2", "Option 42 long long long..."])
40
optionmenu_1.pack(pady=12, padx=10)
41
optionmenu_1.set("CTkOptionMenu")
42
43
combobox_1 = customtkinter.CTkComboBox(frame_1, values=["Option 1", "Option 2", "Option 42 long long long..."])
44
combobox_1.pack(pady=12, padx=10)
45
optionmenu_1.set("CTkComboBox")
46
47
checkbox_1 = customtkinter.CTkCheckBox(master=frame_1)
48
checkbox_1.pack(pady=12, padx=10)
49
50
radiobutton_var = tkinter.IntVar(value=1)
51
52
radiobutton_1 = customtkinter.CTkRadioButton(master=frame_1, variable=radiobutton_var, value=1)
53
radiobutton_1.pack(pady=12, padx=10)
54
55
radiobutton_2 = customtkinter.CTkRadioButton(master=frame_1, variable=radiobutton_var, value=2)
56
radiobutton_2.pack(pady=12, padx=10)
57
58
switch_1 = customtkinter.CTkSwitch(master=frame_1)
59
switch_1.pack(pady=12, padx=10)
60
61
app.mainloop()
62
63