CustomTkinter icon indicating copy to clipboard operation
CustomTkinter copied to clipboard

ComboBox does not refresh after appending values

Open tcheslav9 opened this issue 3 years ago • 0 comments

Hey. Either I am doing something wrong, or comboBox does not refresh with new appended values.

import tkinter
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()
app.geometry("400x580")
app.title("CustomTkinter simple_example.py")


def button_callback():
    print("Button click", combobox_1.get())
    combobox_1.values.append("new item")
    print(combobox_1.values)



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=12, padx=10)

button_1 = customtkinter.CTkButton(master=frame_1, command=button_callback)
button_1.pack(pady=12, padx=10)


combobox_1 = customtkinter.CTkComboBox(frame_1, values=["Option 1", "Option 2", "Option 42 long long long..."])
combobox_1.pack(pady=12, padx=10)

app.mainloop()

Print shows new values added to value attribute of combobox1, but there are no new values displayed when dropping down combobox1.

Best Regards Tcheslav

tcheslav9 avatar Nov 30 '22 21:11 tcheslav9