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 also get home folder for any user by obtaining the environment variable "HOME" through os.getenv(varname)
.
>>> import os
>>> os.getenv("HOME")
'/home/my_user_name'
Your code could look like this:
import os
home = os.getenv("HOME")
my_dir = QtGui.QFileDialog.getExistingDirectory(
self,
"Open a folder",
home,
QtGui.QFileDialog.ShowDirsOnly
)