Lambda in a loop [duplicate]
You need to bind d for each function created. One way to do that is to pass it as a parameter with a default value: lambda d=d: self.root.change_directory(d) Now the d inside the function uses the parameter, even though it has the same name, and the default value for that is evaluated when the function … Read more