from PyQt4.QtGui import QFileDialog filename = QFileDialog.getOpenFileName(None, "Open File", "~/", "All Files (*.*);;Python Files (*.py)")
from PyQt4.QtGui import QFileDialog folder = QFileDialog.getExistingDirectory(None, "Select Directory", "~/")In this example, a directory dialog box opens for the user to select a folder. Once a folder is selected, its path is returned in the variable "folder". Overall, Python PyQt4.QtGui QFileDialog is a useful class for allowing users to interact with files and directories in PyQt4 applications.