View Full Version : Multiple file selection in pyqt Qfiledailoug

March 6th, 2009, 02:20 PM
Hi Guy;

i am working on program that requires me to have multiple file selection to be loaded into my program once i browse through my home directory, here's my file dailoug code to lunch up my file browser... but it can only choose one file at the time..

files = QtGui.QFileDialog.getOpenFileName(self, 'Open file','/home/', ("Images (*.png *.tiff *.jpg)"))

Any idea how to implement multiple file selection?

down is a screen shot to clarify my inquiry


March 6th, 2009, 02:23 PM
Google (actual source (http://lists.trolltech.com/qt-interest/2002-05/thread01189-0.html)) tells me that there's a method getOpenFileNames for multiple file selection.

March 7th, 2009, 04:27 AM
Thank you man, it worked by changing getOpenFileName to getOpenFileNames but i still get the following error

waseem@home:~/Desktop/Project2/GUI$ python wrapphotodb.py
Traceback (most recent call last):
File "wrapphotodb.py", line 49, in _actionImport_Photos
TypeError: coercing to Unicode: need string or buffer, QStringList found

how to implement a buffer for the selected files