5

I am using fileopenbox() and I want to select all text files I have when the windows box is open. I have tried to press shift or ctrl + A, but it didn't work.

openfile = fileopenbox("Welcome", "COPR", filetypes= "*.txt")

3 Answers 3

9

You can select multiple files if you include multiple=True in the arguments:

openfiles = fileopenbox("Welcome", "COPR", filetypes= "*.txt", multiple=True)

Note that now fileopenbox will return not a string, but a list of strings like:

["foo.txt", "Hello.txt", "mytxt.txt"]

Sign up to request clarification or add additional context in comments.

1 Comment

easygui has been around since at least 2002 and the fileopenbox() function in many earlier versions of it don't support a muliple keyword argument (although support for it would be easy to add).
2

another option could be using tkinter as follows(python 3.x):

import tkinter as tk from tkinter import filedialog root = tk.Tk() root.withdraw() files = filedialog.askopenfilenames(parent=root, initialdir="/", title='Please select files')

Comments

1

It's not possible with easygui. What you can do is reuse the code from easygui (see line 1700) and modify it slightly to use askopenfilenames instead of askopenfilename.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.