Diez B. Roggisch wrote:
Hi,
button = Button(self.songWin, text=verse, command=(lambda num=verseNum:
self.showVerse(num)) )
should do the trick. The reason is basically that your version kept a
reference to verseNum - and when executed, the value verseNum points to is
the lasts one stored.
Rebinding the argument to a parameter in the lambda will keep the right
value for each iteration.
I tried it but I got a syntax error. The interpreter didn't like the
equals sign in the lambda. I am using python 2.3.4. Is there another way
of writing that?
thanks
--
http://mail.python.org/mailman/listinfo/python-list