4

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")
madjar
  • 12,691
  • 2
  • 44
  • 52
Ricky
  • 323
  • 2
  • 5
  • 11

3 Answers3

7

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"]

Rodolfo Leibner
  • 171
  • 1
  • 7
  • `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). – martineau Nov 16 '15 at 00:54
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')

tzadok
  • 353
  • 3
  • 12
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.

martineau
  • 119,623
  • 25
  • 170
  • 301
madjar
  • 12,691
  • 2
  • 44
  • 52