I'm trying to create a button that opens local files from a users machine. I have my buttons set up and the function to open files is pretty simple. When clicking the actual button, nothing actually happens. The intended result should be a box that opens that shows local files.
Here's my program so far:
from tkinter import *
import tkinter.filedialog
gui = Tk(className='musicAi')
gui.geometry("500x500")
def UploadAction(event=None):
filename = filedialog.askopenfilename()
print('Selected:', filename)
# create button
importMusicButton = Button(gui, text='Import Music', command = UploadAction, width=40, height=3, bg='#0052cc', fg='#ffffff', activebackground='#0052cc', activeforeground='#aaffaa')
linkAccountButton = Button(gui, text='Link Account', width=40, height=3, bg='#0052cc', fg='#ffffff', activebackground='#0052cc', activeforeground='#aaffaa')
settingsButton = Button(gui, text='Settings', width=40, height=3, bg='#0052cc', fg='#ffffff', activebackground='#0052cc', activeforeground='#aaffaa')
helpButton = Button(gui, text='Help', width=40, height=3, bg='#0052cc', fg='#ffffff', activebackground='#0052cc', activeforeground='#aaffaa')
# add button to gui window
importMusicButton.pack()
linkAccountButton.pack()
settingsButton.pack()
helpButton.pack()
gui.mainloop()