Hi, I am working on a GUI application where I have a multiple number of entry boxes and I created a loop for the label and entry boxes depending upon the number of times it needs to be shown. However, I tried assigning different values to each label and entry boxes in the for loop using lists, so that I can save different values obtained from the entry boxes in the entry lists and use them later.
*However, when I execute it, and type something in one entrybox, it shows in all the entry boxes using multi-cursor option. * Can someone please tell me how I can avoid this error? I am trying to put a for loop since I need to create the gui such that the number of times it needs to be done would be unknown. Hence, the way I went about this was to take an upper limit of 3 and thus, reacoriginal = [" ", " ", " "]. This can be used as an upper limit and the required number can thus fit in as needed. Here, for example, I have taken the required number as two. this would be later modified. Code: from Tkinter import * root = Tk() root.geometry("500x350") # Variables: reacoriginal = [" ", " ", " "] conca = [1,0,0] print conca[0] concunit = [" ", " ", " "] concunit11 = StringVar() concunit21 = StringVar() concunit31 = StringVar() conca1 = IntVar() conca1.set(1) concb1 = IntVar() concc1 = IntVar() average = [" ", " ", " "] lowest = [" ", " ", " "] highest = [" ", " ", " "] averageformulation = [" ", " ", " "] lowestformulation = [" ", " ", " "] highestformulation = [" ", " ", " "] print average reactants = ["A", "B", "C"] for i in range(len(reactants)): Label(root, text = "Experimental Range").grid(row = 0, column = 0, sticky = W) labeldown = Label(root, text = "For Parameter Estimation") labeldown.grid(row = 1, column = 0, sticky = W) labeldown.config(state='disable') Label(root, text = "Average ").grid(row = 2, column = 1, sticky = W) Label(root, text = "Lowest ").grid(row = 2, column = 2, sticky = W) Label(root, text = "Highest").grid(row = 2, column = 3, sticky = W) Label(root, text = "Units").grid(row = 2, column = 4, sticky = W) Checkbutton(root, text = reactants[i], variable = conca[i]).grid(row = 3+i, column = 0, sticky = W) optionlist2 = [u'\u03bcmol/L', 'mmol/L','mol/L'] concunitdrop = OptionMenu(root, concunit[i], *optionlist2) concunitdrop.config(width = 8) concunitdrop.grid(row = 3+i, column = 4, sticky = W) for i in range(len(reactants)): *Entry*(root, textvariable =* average[i]*, width = 15, state=DISABLED).grid(row = 3+i, column = 1, sticky = W) *Entry*(root, textvariable = *lowest[i]*, width = 15).grid(row = 3+i, column = 2, sticky = W) *Entry*(root, textvariable = *highest[i]*, width = 15).grid(row = 3+i, column = 3, sticky = W) root.mainloop() _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor