2011-12-14 4 views

답변

5

사용 QFileDialog.getOpenFileNames 여러 파일을 사용자가 선택할 수 있도록 :

from PyQt4 import QtGui, QtCore 

class Window(QtGui.QWidget): 
    def __init__(self): 
     QtGui.QWidget.__init__(self) 
     layout = QtGui.QVBoxLayout(self) 
     self.button = QtGui.QPushButton('Select Files', self) 
     layout.addWidget(self.button) 
     self.button.clicked.connect(self.handleButton) 

    def handleButton(self): 
     title = self.button.text() 
     for path in QtGui.QFileDialog.getOpenFileNames(self, title): 
      print path 

if __name__ == '__main__': 

    import sys 
    app = QtGui.QApplication(sys.argv) 
    window = Window() 
    window.show() 
    sys.exit(app.exec_()) 
0

사용자가 즐겨 사용하는 파일 브라우저에서 직접 파일을 추가하려면 & 드래그를 사용하도록 설정하는 것이 좋습니다. 내가 어떤 문제없이 wxPython을에 이런 짓을하고 사용자 피드백 꽤 좋은으로 :)

관련 문제