Im trying to make a File list in Tkinter, i used the code
for Base,dir,Files in os.walk(str(Proj_Selected)):
for File in enumerate(Files,start=0):
_File = File[0]
print(File)
FileButton[str(_File)] = Button(ToolBarb,text=Files[_File],bg='#383838',fg='white',font=("Bold", 3),highlightthickness=0,borderwidth=0,command= lambda: CodeUpdate(File[1]))
FileButton[str(_File)].grid(column=1*_File,row=0,padx=1)
the files are
(0, 'main.py')
(1, 'DateCreated.txt')
(2, 'Password.txt')
(3, 'permissions.conf')
but the output of the function is all the same
Projects/fils/
permissions.conf
Projects/fils/
permissions.conf
Projects/fils/
permissions.conf
Projects/fils/
permissions.conf
The function is
def CodeUpdate(file):
global textcore,Proj_Selected
Proj = Proj_Selected
code = open(Proj+file).read()
print(Proj)
print(file)
print(code)
textcore.insert(INSERT,code)
textcore.update_idletasks()