Apr-24-2020, 06:59 PM
Thank you Larz60,
I tried using the grid_info method and it is still returning row 4 column 1 no matter which entry widget I am entering values.
I tried using the grid_info method and it is still returning row 4 column 1 no matter which entry widget I am entering values.
from tkinter import * from tkinter import ttk def set_input(frame,self): row = self.grid_info()["row"] col = self.grid_info()["column"] print("row "+str(row)+", column "+str(col)) return(True) mw = Tk() # 999x999 is size of window, 999+999 is the location of the window mw.geometry('600x200+400+200') mw.title("test program") frame1 = Frame(mw) frame1.pack(side=TOP) framebot = Frame(mw) framebot.pack(side=BOTTOM,fill=X) field_labels = ["field1","field2","field3"] values = [] for i in range(0,5): values.append([]) j = 0 values[i].append(Entry(frame1,validate="focusout",validatecommand=lambda:set_input(frame1,values[i][j]))) values[i][j].grid(row=i, column= j) j += 1 values[i].append(ttk.Combobox(frame1,values=field_labels,validate="focusout",validatecommand=lambda:set_input(frame1,values[i][j]))) values[i][j].grid(row=i, column= j) btn = Button(framebot,text='Exit',font=("Times",16),command=mw.quit).pack(side="left") mw.mainloop()