0

I use the following code to create dynamic radio buttons grid:

for data in self.datatoparse:
    Label(self.topframe, text=data["column"]).grid(row=row, column=0)
    for k in range(0,columnscount):
        var = {"column":data["column"],"index":k}
        Radiobutton(self.topframe, text="", variable=data, value=var, command=lambda: self.test(row,var)).grid(row=row, column=k+1)
    row = row + 1

When I click on a radio button it does not update the elements inside self.datatoparse list.

Thanks for your help

Tarik Mokafih
  • 1,247
  • 7
  • 19
  • 38
  • 1
    Is this your problem? http://stackoverflow.com/questions/17677649/tkinter-assign-button-command-in-loop-with-lambda – Franz Wexler Dec 16 '16 at 15:21
  • Thanks, this fixes the problem of the lambda but the datatoparse list is not updated – Tarik Mokafih Dec 16 '16 at 15:28
  • 1
    Why do you think `dataoparse` should be updated? There's no code trying to update it. What does "update" even mean here? – Bryan Oakley Dec 16 '16 at 15:30
  • The code iterates through "datatoparse" using "data" element. "data" is the variable linked to each row of radio buttons so whenever I click on a Radio button "data" should get the value of that radio – Tarik Mokafih Dec 16 '16 at 15:33
  • is `data` a `StringVar`, `IntVar`, etc. If not then it will no update automatically. Your `data` has some `data["column"]` so it seams it is some dictionary, not `StringVar`, `IntVar`, etc. – furas Dec 16 '16 at 16:00

0 Answers0