I'm using PyQt4.
filename = QtGui.QFileDialog.getSaveFileName(self, "Save file", "", "CSV files (*.csv)|*.csv")
Now when I click cancel button,the next code is executing. But, I don't want this instead I want it to do nothing. How can I achieve this?
If filename is None:
stop excute code.
If the user presses Cancel, getSaveFileName
returns a null string.
You can use the fact that empty sequences are false. So, you should use:
if filename:
or
if not filename: