When using the QFileDialog.getExistingDirectory
I\'ve found the way to specify the default path to a directory. I wanted to use a default directory somewhere in my
You can get the user's home directory by using os.path.expanduser
>>> from os.path import expanduser
>>> expanduser("~")
/home/user_name
This works on Windows and Linux.
Your code block will look like this then
my_dir = QtGui.QFileDialog.getExistingDirectory(
self,
"Open a folder",
expanduser("~"),
QtGui.QFileDialog.ShowDirsOnly
)