mirror of
https://github.com/TomSchimansky/CustomTkinter.git
synced 2023-08-10 21:13:13 +03:00
small fixes for CTkComboBox
This commit is contained in:
@ -4,56 +4,60 @@ import customtkinter
|
||||
customtkinter.set_appearance_mode("dark") # Modes: "System" (standard), "Dark", "Light"
|
||||
customtkinter.set_default_color_theme("blue") # Themes: "blue" (standard), "green", "dark-blue"
|
||||
|
||||
app = customtkinter.CTk() # create CTk window like you do with the Tk window
|
||||
app.geometry("400x540")
|
||||
app = customtkinter.CTk()
|
||||
app.geometry("400x580")
|
||||
app.title("CustomTkinter simple_example.py")
|
||||
|
||||
|
||||
def button_function():
|
||||
print("Button click")
|
||||
def button_callback():
|
||||
print("Button click", combobox_1.get())
|
||||
|
||||
|
||||
def slider_function(value):
|
||||
def slider_callback(value):
|
||||
progressbar_1.set(value)
|
||||
|
||||
|
||||
y_padding = 13
|
||||
|
||||
frame_1 = customtkinter.CTkFrame(master=app)
|
||||
frame_1.pack(pady=20, padx=60, fill="both", expand=True)
|
||||
|
||||
label_1 = customtkinter.CTkLabel(master=frame_1, justify=tkinter.LEFT)
|
||||
label_1.pack(pady=y_padding, padx=10)
|
||||
label_1.pack(pady=12, padx=10)
|
||||
|
||||
progressbar_1 = customtkinter.CTkProgressBar(master=frame_1)
|
||||
progressbar_1.pack(pady=y_padding, padx=10)
|
||||
progressbar_1.pack(pady=12, padx=10)
|
||||
|
||||
button_1 = customtkinter.CTkButton(master=frame_1, command=button_function)
|
||||
button_1.pack(pady=y_padding, padx=10)
|
||||
button_1 = customtkinter.CTkButton(master=frame_1, command=button_callback)
|
||||
button_1.pack(pady=12, padx=10)
|
||||
|
||||
slider_1 = customtkinter.CTkSlider(master=frame_1, command=slider_function, from_=0, to=1)
|
||||
slider_1.pack(pady=y_padding, padx=10)
|
||||
slider_1 = customtkinter.CTkSlider(master=frame_1, command=slider_callback, from_=0, to=1)
|
||||
slider_1.pack(pady=12, padx=10)
|
||||
slider_1.set(0.5)
|
||||
|
||||
entry_1 = customtkinter.CTkEntry(master=frame_1, placeholder_text="CTkEntry")
|
||||
entry_1.pack(pady=y_padding, padx=10)
|
||||
entry_1.pack(pady=12, padx=10)
|
||||
|
||||
optionmenu_1 = customtkinter.CTkOptionMenu(frame_1, values=["Option 1", "Option 2", "Option 42"])
|
||||
optionmenu_1.pack(pady=10, padx=10)
|
||||
s = customtkinter.StringVar(value="test")
|
||||
|
||||
optionmenu_1 = customtkinter.CTkOptionMenu(frame_1, values=["Option 1", "Option 2", "Option 42"], variable=s)
|
||||
optionmenu_1.pack(pady=12, padx=10)
|
||||
optionmenu_1.set("CTkOptionMenu")
|
||||
|
||||
combobox_1 = customtkinter.CTkComboBox(frame_1, values=["Option 1", "Option 2", "Option 42"], variable=s)
|
||||
combobox_1.pack(pady=12, padx=10)
|
||||
optionmenu_1.set("CTkComboBox")
|
||||
|
||||
checkbox_1 = customtkinter.CTkCheckBox(master=frame_1)
|
||||
checkbox_1.pack(pady=y_padding, padx=10)
|
||||
checkbox_1.pack(pady=12, padx=10)
|
||||
|
||||
radiobutton_var = tkinter.IntVar(value=1)
|
||||
|
||||
radiobutton_1 = customtkinter.CTkRadioButton(master=frame_1, variable=radiobutton_var, value=1)
|
||||
radiobutton_1.pack(pady=y_padding, padx=10)
|
||||
radiobutton_1.pack(pady=12, padx=10)
|
||||
|
||||
radiobutton_2 = customtkinter.CTkRadioButton(master=frame_1, variable=radiobutton_var, value=2)
|
||||
radiobutton_2.pack(pady=y_padding, padx=10)
|
||||
radiobutton_2.pack(pady=12, padx=10)
|
||||
|
||||
switch_1 = customtkinter.CTkSwitch(master=frame_1)
|
||||
switch_1.pack(pady=y_padding, padx=10)
|
||||
switch_1.pack(pady=12, padx=10)
|
||||
|
||||
app.mainloop()
|
||||
|
Reference in New Issue
Block a user