Defaults binding code
for i in range(10):
def callback(i=i):
print "clicked button", i
UI.Button("button %s" % i, callback)
# The “i=i” part binds the parameter “i” (a local variable)
# to the current value of the outer variable “i”.