def __init__(self): self.startingDir = QDir.rootPath() self.dialog = QFileDialog() self.dialog.setFileMode(QFileDialog.FileMode()) #self.rootdir = self.dialog.getExistingDirectory(None, 'Choose directory', self.startingDir) self.rootdir = QDir.rootPath() super(DirectoryDialog, self).__init__()
def browseHandler(): dialog = QFileDialog() dialog.setFileMode(QFileDialog.FileMode()) dir = dialog.getExistingDirectory(None) if dir[-1] == "/": dir = dir[:-1] dir = dir.replace("/","\\") return(dir)