Created
May 3, 2018 14:26
-
-
Save nikhilkumarsingh/406dd9b65e6424f80633e4e6c9c87fb3 to your computer and use it in GitHub Desktop.
Example to select files using File Explorer Dialog Box in Python
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from PyQt5.QtWidgets import QFileDialog, QApplication | |
from PyQt5 import QtWidgets | |
def select_files(directory_location=None): | |
qtapp = QApplication([directory_location]) | |
qtwgt = QtWidgets.QWidget() | |
filenames, _ = QFileDialog.getOpenFileNames(qtwgt) | |
return filenames | |
def main(): | |
filenames = select_files() | |
print("You selected:\n", "\n".join(filename for filename in filenames)) | |
if __name__ == "__main__": | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment