I want a tkinter button to do one thing or another depending on what file the function finds in a specific directory.
Is it possible to do it with something like this sample code, or how could it be accomplished? (This code seems to ignore the "else" part of the function.)
def test():
x = glob('C:/*file1.txt')[0]
y = glob('C:/*file2.txt')[0]
if x:
#Do stuff
else:
#Do this stuff
tk.Button(root,
text = "Test",
command = test,
fg="gray17",
width = 15).pack()
Aucun commentaire:
Enregistrer un commentaire