Home > Software design >  Tkinter how to sort dynamically added buttons
Tkinter how to sort dynamically added buttons

Time:01-27

I am trying to create a pop up window in customtkinter with dynamically added checkboxes (this creates 80 checkboxes).

def open_secondary_window(self):
    # Create secondary (or popup) window.
    secondary_window = customtkinter.CTkToplevel()
    secondary_window.geometry(f"{400}x{200}")        
    secondary_window.title("Object Selection")
    
    # Create a button to close (destroy) this window.
    for i in range(len(class_names)): 
        c = customtkinter.CTkCheckBox(secondary_window, text=class_names[i])
        c.pack()
            
    button_close = customtkinter.CTkButton(
    secondary_window,
    text="Close window",
    command=secondary_window.destroy)
    button_close.place(x=75, y=75)`

screenshot

  • Related