file = QtWidgets.QFileDialog.getOpenFileName()
I have used the above to get the path of a file. The output is:
('D:/test images/test13.jpg', '')
What should i do to get the output as: 'D:/test images/test13.jpg'
?
file = QtWidgets.QFileDialog.getOpenFileName()
I have used the above to get the path of a file. The output is:
('D:/test images/test13.jpg', '')
What should i do to get the output as: 'D:/test images/test13.jpg'
?
QFileDialog.getOpenFileName()
in PyQt5 is the same as QFileDialog.getOpenFileNameAndFilter()
in PyQt4, it returns the file name and the filter selected by the user. You can use
file = QtWidgets.QFileDialog.getOpenFileName()[0]
to get only the file, or
file, filter = QtWidgets.QFileDialog.getOpenFileName()
which I find clearer because it's immediately obvious what the method returns.