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.


-- 
Regards,

Diez B. Roggisch
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to