Hello, Im new to python. For some reason my code isnt working. Im making a app that shows you your files to run. This is what i have so far.
import tkinter as tk
from tkinter import filedialog, Text
import os
root = tk.Tk()
def addApp():
filename = filedialog.askopenfilename(initialdir="/", title="Select File"
filetypes=(("executables","*.exe"), ("all files", "*.*")))
canvas = tk.Canvas(root, height=500, width=600, bg="lightblue")
canvas.pack()
frame = tk.Frame(root, bg="white")
frame.place(relwidth=0.8, relheight=0.8, relx=0.1, rely=0.1)
openFile = tk.Button(root, text="Open Files", padx=10, pady=5, fg="white", bg="#263D42" command=addApp)
openFile.pack()
runApps = tk.Button(root, text="Run Apps", padx=10, pady=5, fg="white", bg="#263D42")
runApps.pack()
root.mainloop()
My code says that the line “filetypes=((“executables”,”.exe"), (“all files”, ".*")))" Is a invalid syntax. I click on it and then it shows “filetypes” highlighted.
Please help me. Thanks