Get multiple file names (PyQT/PySide)

vegaseat 3 Tallied Votes 3K Views Share

A simple test of PySide's QFileDialog widget and its method getOpenFileNames. Use method getOpenFileName if you want just one file name.

a very simple template to test PySide widgets ...

get a list of full path multiple filenames via
(press ctrl key or shift key when selecting multiple files)

for Python33 you can use the Windows self-extracting installer
PySide is the official LGPL-licensed version of PyQT

Tested with Python27 and Python33  by   vegaseat  16apr2013

from PySide.QtCore import *
from PySide.QtGui import *

# replace [] with sys.argv for commandline
app = QApplication([])

# ----- start your widget test code ----

caption = 'Open file'
# use current/working directory
directory = './'
filter_mask = "Python/Text files (*.py *.pyw *.txt)"
filenames = QFileDialog.getOpenFileNames(None,
    caption, directory, filter_mask)[0]

print(filenames)  # test

# ---- end of widget test code -----

# for this case ...