code is in the end. I want to print different number when pressing different button. Yet the program outputs 8 no matter which button is pressed. I guess it's because the callback function is not established untill the button is pressed, and i has already reached to 8.
then How to add callbacks that is the same function with different argument? CODE: from Tkinter import * root = Tk() def func(x): print x return func_en=[] for i in range(9): func_en.append(lambda:func(i)) for i in range(9): func_en[i]() for i in range(9): Button(root, text='%d'%i, command=func_en[i]).pack()
-- http://mail.python.org/mailman/listinfo/python-list