A class you can use to get list of files into a listbox. I called it FileList and when you make an istance of this class you pass the file type as argument to see the files in the listbox, like this:
FileList(“mp4”)
The output will be something like this:
The files will be listed into the listbox
Put the type of file as an argument to get the list of that particular file type
from glob import glob import tkinter as tk class FileList: def __init__(self, ft): root = tk.Tk() root.geometry("400x800") lb = tk.Listbox(root) lb.configure(bg="gold") lb.pack(fill="both", expand=True) fl = glob("*." + ft) for f in fl: lb.insert(0,f) root.mainloop() FileList("py")
Subscribe to the newsletter for updates
Tkinter templates
My youtube channel
Twitter: @pythonprogrammi - python_pygame