Mayank
Mayank

Reputation: 1993

Unable to select multiple files in tkinter

I'm unable to select multiple files using tkinter's askopenfilenames on linux. I can select multiple files on windows but not on linux.

path = list(askopenfilenames(filetypes=('Images','*.jpg *.jpeg *.png')))

Upvotes: 1

Views: 1150

Answers (1)

scotty3785
scotty3785

Reputation: 7006

The following code will allow you to select multiple files. You need to hold Control or Shift as you select each file

import tkinter as tk
from tkinter import filedialog

root = tk.Tk()
root.withdraw()

path = list(filedialog.askopenfilenames(filetypes=[('Images','*.jpg *.jpeg *.png')]))
print(path)

Upvotes: 0

Related Questions