<div dir="ltr"><span style="font-size:12.8px">>>> from PyQt5 import QtWidgets</span><br style="font-size:12.8px"><span style="font-size:12.8px">>>> app = QtWidgets.QApplication([''])</span><br style="font-size:12.8px"><span style="font-size:12.8px">>>> QtWidgets.QFileDialog.getOpenF</span><wbr style="font-size:12.8px"><span style="font-size:12.8px">ileNames()</span><br style="font-size:12.8px"><span style="font-size:12.8px">(['/usr/lib/python3.5/re.py', '/usr/lib/python3.5/os.py', '/usr/lib/python3.5/io.py'], 'All Files (*)')</span><br><div><span style="font-size:12.8px"><br></span></div><div><span style="font-size:12.8px">This code works correctly for me as well on OS X.11 with PyQt5 via Anaconda</span></div><div><span style="font-size:12.8px"><br></span></div><div><span style="font-size:12.8px">The method returns a tuple containing two items. The first of which is a list of file paths and the second is the file filter that was active when selecting files.</span></div><div><span style="font-size:12.8px"><br></span></div><div><span style="font-size:12.8px">-Maxwell</span></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Dec 1, 2016 at 1:19 PM, Baz Walter <span dir="ltr"><<a href="mailto:bazwal@ftml.net" target="_blank">bazwal@ftml.net</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On 01/12/16 12:26, Massimo Vassalli wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Dear all,<br>
<br>
I found a strange behaviour (a bug ?) In the new implementation<br>
of QFileDialog I'm using with Qt5.7 / PyQt5.7.<br>
<br>
In short, the static function QFileDialog.getOpenFileNames() which is<br>
expected to let the user selet more than one file and return a list, does<br>
only half of the job. The dialog is executed with FileMode set to<br>
QFileDialog.ExistingFiles (so that the user can select more than one file)<br>
but the function returns only the first file of the list (the first clicked<br>
file, to be precise). A workaround is to instantiate the class QFileDialog<br>
and use it:<br>
<br>
q = QtWidgets.QFileDialog()<br>
q.setAcceptMode(QtWidgets.QFil<wbr>eDialog.AcceptOpen)<br>
q.setFileMode(QtWidgets.QFileD<wbr>ialog.ExistingFiles)<br>
fnames = q.selectedFiles()<br>
<br>
Should it be considered a bug or was I wrong in using the static function ?<br>
</blockquote>
<br>
Works okay for me:<br>
<br>
>>> from PyQt5 import QtWidgets<br>
>>> app = QtWidgets.QApplication([''])<br>
>>> QtWidgets.QFileDialog.getOpenF<wbr>ileNames()<br>
(['/usr/lib/python3.5/re.py', '/usr/lib/python3.5/os.py', '/usr/lib/python3.5/io.py'], 'All Files (*)')<br>
<br>
______________________________<wbr>_________________<br>
PyQt mailing list <a href="mailto:PyQt@riverbankcomputing.com" target="_blank">PyQt@riverbankcomputing.com</a><br>
<a href="https://www.riverbankcomputing.com/mailman/listinfo/pyqt" rel="noreferrer" target="_blank">https://www.riverbankcomputing<wbr>.com/mailman/listinfo/pyqt</a></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div>University of New Hampshire</div><div>Department of Physics</div><div>Pohl Group</div><div>DeMeritt Hall 119</div><div>---</div>Síocháin agus Grá</div></div>
</div>