How to get a for loop to work with tkinter in python 2.7?
It's not the for loop, It's that you are setting the same variable twice. here:
for row in rows: #printing second & third column(See tuples) #sets the variable self.labelVariable.set(row[1]) #sets the variable again to a different value self.labelVariable.set(row[2])
you could do something like:
label = "" for row in rows: label += row[1] + ":" + row[2] + "\n" self.labelVariable.set(label) #print to check the label string print label
Which generates the string first and then sets the value. The label value should contain the two values with a colon between them with newlines separating the rows.