K
K
kuzdman2019-01-10 14:20:19
Python
kuzdman, 2019-01-10 14:20:19

How to create PyQT5 file dialog for directories?

How do I describe a file dialog in PyQT5 to select a directory?
Googled but didn't find a clear answer.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
iBuilder, 2019-01-10
@iBuilder

Poorly searched most likely.
I don't know how in PyQT5, but most likely the same as in PySide2, where I did this:
options = QtWidgets.QFileDialog.DontResolveSymlinks | QtWidgets.QFileDialog.ShowDirsOnly
dir_cur = QtCore.QDir.currentPath() is optional.
directory = QtWidgets.QFileDialog.getExistingDirectory(None, "Find Files", dir_cur, options)
if directory:
do what you want here.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question