Q:

Retrieving the path of a file in PyQt

I am developing a UI with PyQt4 where I want when the user clicks on the "save" button, a file dialog should appear and the user would specify just the directory(and not the file name) where he wants to store the file. Later I want to fetch the path of the directory specified by the user and display it in a label. 
       This might be a silly question but since I am new to Python programming, any help would be appreciated. 

A:

Hope you are not saving file now, you just need only the directory and display it somewhere.
There is something called QFileDialog Widget, which will do this task. It will not save the file but just return the user selected path.
filename = QtGui.QFileDialog.getSaveFileName(self, "Save file", "", ".jpeg")

'filename' holds the file path which is selected by user. When you press save button, it doesnt actualy save the data. It just return the filepath, you need to manually save the file.
I am not an expert in python, i will be happy if this helps you.

