Dídac, aquest és un problem molt interessant. Your code doesn't work because you didn't pass in a reference to i in your lambda. The correct code appears below. BTW, if you set up your application with classes and methods, you will need to pass in a reference to self in the same way: self=self.
from Tkinter import * root = Tk(); def cb(x): print x; for i in range(5): b = Button(root,text=i,command=lambda i=i:cb(i)); b.pack(); root.mainloop(); cheers Stewart
_______________________________________________ Tkinter-discuss mailing list [email protected] http://mail.python.org/mailman/listinfo/tkinter-discuss
