Skip to content

Instantly share code, notes, and snippets.

@harendra21
Created May 12, 2022 05:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save harendra21/4ad5c1272ec8f6d4bf5ca13f0706ae14 to your computer and use it in GitHub Desktop.
Save harendra21/4ad5c1272ec8f6d4bf5ca13f0706ae14 to your computer and use it in GitHub Desktop.
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