Jul-19-2020, 06:14 AM
You need to freeze the value of the passed argument, otherwise lambda tries to pull the variable from the current scope.
for choice in drop_down: menu_items[row_pos][choice] = IntVar(value=0) menus[row_pos].add_checkbutton(label=choice, variable=menu_items[row_pos][choice], onvalue=1, offvalue=0, command=lambda x=row_pos:printValues(x))You should also take a look at functools.partial. I find partial often works better than lambda for this sort of thing.