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
button[num] = Tkinter.Button(frame,text = returnstring, command=callback(returnstring))# this line executes on creation my output on startup is (should output when I choose an option) 1 String pad 10 Chorus 25 Reverb 30 Mixer The buttons do label correctly. title = 'csd instrument list' # Import Pmw from this directory tree. import sys sys.path[:0] = ['../../..'] import Tkinter import Pmw import csoundroutines class Demo: def __init__(self, parent): frame = Tkinter.Frame(parent) frame.pack(fill = 'both', expand = 1) button = {} instr = [[]] instr = csoundroutines.csdInstrumentList2(sys.argv[1]) num = 0 #instr_number buttonBox = Pmw.ButtonBox(parent) for i in range(0, len(instr.instrnum)): num += 1 returnstring = instr.instrnum[i] +' '+ str(instr.comments[i]) #printstring = zz + x[num] button[num] = Tkinter.Button(frame,text = returnstring, command=callback(returnstring))#kinter.Buttonstr(x[0]) + ' ' + x[1])# + comments) button[num].pack() #returnstring = zz button[num].grid(column=num, row = 0)#,command=callback(returnstring)) #button[num].pack() frame.grid_rowconfigure(3, weight=1) frame.grid_columnconfigure(3, weight=1) frame.pack() def callback(text): print text ###################################################################### # Create demo in root window for testing. if __name__ == '__main__': global filename filename = (sys.argv[1]) root = Tkinter.Tk() Pmw.initialise(root) root.title(title) exitButton = Tkinter.Button(root, text = 'Exit', command = root.destroy) exitButton.pack(side = 'bottom') widget = Demo(root) root.mainloop() http://www.dexrow.com -- http://mail.python.org/mailman/listinfo/python-list