small fixes for CTkComboBox

This commit is contained in:
Tom Schimansky
2022-06-01 23:50:50 +02:00
parent 0aa9dfc70f
commit 550653c6c3
8 changed files with 80 additions and 86 deletions

View File

@ -1,4 +1,5 @@
import tkinter
import tkinter.ttk as ttk
import customtkinter
app = customtkinter.CTk()
@ -22,4 +23,10 @@ optionmenu_tk.pack(pady=10, padx=10)
optionmenu_1 = customtkinter.CTkOptionMenu(app, variable=variable, values=countries, command=select_callback)
optionmenu_1.pack(pady=10, padx=10)
combobox_tk = ttk.Combobox(app, values=countries)
combobox_tk.pack(pady=10, padx=10)
combobox_1 = customtkinter.CTkComboBox(app, variable=variable, values=countries, command=select_callback)
combobox_1.pack(pady=10, padx=10)
app.mainloop()

View File

@ -73,8 +73,8 @@ switch_1.pack(pady=20, padx=10)
optionmenu_var = tkinter.StringVar(value="test")
optionmenu_1 = customtkinter.CTkOptionMenu(master=app, variable=optionmenu_var, values=["Option 1", "Option 2", "Option 3"])
optionmenu_1.pack(pady=20, padx=10)
optionmenu_2 = customtkinter.CTkOptionMenu(master=app, values=["Option 1", "Option 2", "Option 3"])
optionmenu_2.pack(pady=20, padx=10)
optionmenu_2.configure(variable=optionmenu_var)
combobox_1 = customtkinter.CTkComboBox(master=app, values=["Option 1", "Option 2", "Option 3"])
combobox_1.pack(pady=20, padx=10)
combobox_1.configure(variable=optionmenu_var)
app.mainloop()

View File

@ -48,5 +48,10 @@ optionmenu_1.pack(pady=10, padx=10)
button_6 = customtkinter.CTkButton(master=app, text="Disable/Enable optionmenu_1", command=lambda: change_state(optionmenu_1))
button_6.pack(padx=20, pady=(10, 20))
combobox_1 = customtkinter.CTkComboBox(app, values=["test 1", "test 2"])
combobox_1.pack(pady=10, padx=10)
button_7 = customtkinter.CTkButton(master=app, text="Disable/Enable combobox_1", command=lambda: change_state(combobox_1))
button_7.pack(padx=20, pady=(10, 20))
app.mainloop()