'How to add menu in python from a loop

for user in users:
            
   self.user_menu.add_command(label=user[0], command=lambda: 
   self.userChange(user[0]))

in the label user[0] works fine but in the command function only the last element of the user list is sent to the function userChange how can i make this works. Please help



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source