I'm currently working on a program to scan a folder, find all the .exe files and place them in a list ready to run.
So far, I have managed to get the list, create the buttons, but not then run the program itself. Instead it is running the programs upon opening running the python code.
import os
import Tkinter
top = Tkinter.Tk()
def run(exe):
os.system(exe)
exes = []
for root, dirs, files in os.walk(r'./'):
for file in files:
if file.endswith('.exe'):
exes.append(file)
def dispgames(exes):
exes = exes[:-4]
return exes
def runit(game):
os.system(game)
#print(exes)
#print(dispgames(exes))
def radioCreate(typeArray):
for t in typeArray:
b = Tkinter.Button(top, text = dispgames(t), command=runit(t))
b.pack()
radioCreate(exes)
Tkinter.Button(top, text = "Display").pack()
top.mainloop()
Any help would be greatly appreciated.