I think that's a python beginner question.
my goal is to pass a variable (idx
) to a function that is given as argument.
I tried to wrap the function call, to pass the variable as argument, but for some reason the result is not as I expected.
Here is the code:
for idx, path in enumerate(paths):
def _mf(t):
return make_frame(t, idx)
clip2 = VideoClip(_mf, False, 10)
This loop will iterate for 2 items. And the two clip will call the make_frame function respectively. But the the second argument (idx) will always be "1" for both clips. I don't understand this.
Can anybody help me? Thanks