def open(self): path = QFileDialog.getOpenFileName(self, 'Open a file', '', 'All Files (*.*)') if path != ('', ''): print(path[0])