title: how to create a File Dialog in python using PyQt5
body: <p>i have python class called PDFviewer that upon run the program the system display a window that handle button <strong>(open folder)</strong> witch will open a file Dialog that allow the user to choose a directory and display files inside it.</p>
  
  <p>the problem is that when i try to click the  button the system crash and display this error :</p>
  
  <blockquote>
    <p>File
    "C:\Users\test\Documents\Python_Projects\final_project\myPDFviewer.py",
    line 36, in    sys.exit(app.exec_()) File
    "C:\Users\test\Documents\Python_Projects\final_project\myPDFviewer.py",
    line 24, in setExistingDirectory   options=options)</p>
    
    <p>builtins.TypeError: getExistingDirectory(parent: QWidget = None,
    caption: str = '', directory: str = '', options:
    Union[QFileDialog.Options, QFileDialog.Option] =
    QFileDialog.ShowDirsOnly): argument 1 has unexpected type 'bool'</p>
  </blockquote>
  
  <h1>code:</h1>
  
  <pre><code>from PyQt5 import QtCore, QtGui, QtWidgets
  from PyQt5.QtWidgets import (QApplication, QCheckBox, QColorDialog, QDialog,
                               QErrorMessage, QFileDialog, QFontDialog, QFrame, QGridLayout,
                               QInputDialog, QLabel, QLineEdit, QMessageBox, QPushButton)
  
  from PyQt5.QtCore import QDir, Qt
  
  import pdfviewer
  
  class pdfViewer(pdfviewer.Ui_PdfPreviewWindow):
  
      def __init__(self,PdfPreviewObj ):
          self.PdfPreviewObj =PdfPreviewObj 
          self.setupUi(PdfPreviewObj)
          self.PdfPreviewObj.show()
          self.pushButtonOpenFolder.clicked.connect(self.setExistingDirectory)
  
  
  
      def setExistingDirectory(self,qf):    
          options = QFileDialog.DontResolveSymlinks | QFileDialog.ShowDirsOnly
          directory = QFileDialog.getExistingDirectory(self,
                                                       "Open Folder",
                  options=options)
  
  
  
  
  
  
  if __name__ == "__main__":
      import sys
      app = QtWidgets.QApplication(sys.argv)
      PdfPreviewWindow = QtWidgets.QMainWindow()
      pdfViewerUi = pdfViewer(PdfPreviewWindow)
      sys.exit(app.exec_())
  </code></pre>