My program searches files from a directory and list those which have a keyword. Now the search result is displayed using a tkinter Label. Need to open the said file on click. However whichever file you click it opens only the last file in the directory. Where is the error?I have attached screenshot of the final output.
Code is:-
if found:
Filecount=Filecount+1
if Filecount % 2 == 0:
bgc="#CCE5FF"
else:
bgc="#FFE5CC"
succ_filename.append(filename)
label4= Label(main,text=(str(Filecount)+'. '+filename),font=("Helvetica 12"),bg=bgc)
label4.grid(row =5+Filecount,column=1,sticky=W)
label4.bind("<Button-1>", lambda e:callback(succ_filename[Filecount-1]))