-1

i'm trying to create several buttons that depends on a dict which could be flexible. So i made a function which creates all my buttons with the good appellation, but it seems like the command doesn't work when i click on this new button. The command should have the same name as the button which is a value in a dict which is also a value in another dict. Im newbi here Thanks for back up

here is my function :

def simple_meals():
    colonne = 0
    healthy_frame.pack_forget()
    great_frame.pack_forget()
    cheat_frame.pack_forget()
    for i in meals["simple"]:
        a = (meals["simple"].index(i))
        b = meals["simple"][a]. 
        button = tk.Button(simple_frame, text=b, highlightbackground="#CCCCCC",
                           font=("Calibri", 18), fg="#000", command=b)
        button.grid(column=colonne, row=0)
        colonne += 1
    simple_frame.pack() Frame for my new buttons

0 Answers0