> button[num] = Tkinter.Button(frame,text = returnstring, > command=callback(returnstring))#
I understand this part of it def callback(text): def handler(event): print text It stopped calling it automaticaly but will not do anything when I click on the button. Does something have to change on this line as well. button[num] = Tkinter.Button(frame,text = returnstring, > command=callback(returnstring) Gabriel Genellina wrote: > <[EMAIL PROTECTED]> escribió en el mensaje > news:[EMAIL PROTECTED] > > > Instead of creating my buttons and waiting for me to press them to > > execute they are executing when I create them and won't do my callback > > when I press them.. thanks for any help in advance > > This is a very frequent beginner's mistake. You are *calling* the event > handler at the moment you create the buttons. You have to provide a > *callable* but not call it yet. > > > button[num] = Tkinter.Button(frame,text = returnstring, > > command=callback(returnstring))# > > So `callback` should return a function, like this: > > def callback(text): > def handler(event): > print text > > -- > Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list