pyqt open file dialog

Solutions on MaxInterview for pyqt open file dialog by the best coders in the world

showing results for - "pyqt open file dialog"
Ismael
22 Jun 2016
1import sys
2from PyQt5.QtWidgets import QApplication, QMainWindow, QWidget, \
3    QPushButton, QVBoxLayout, QFileDialog
4
5# you can copy and run this code
6
7class MainWindow(QMainWindow):
8    def __init__(self, parent=None):#--------------
9        super(MainWindow, self).__init__(parent)#  |
10        self.setWindowTitle("open file dialog")#   |
11#												   |
12        btn = QPushButton("Open File")#            |---- Just initialization
13        layout = QVBoxLayout()#					   |
14        layout.addWidget(btn)#                     |
15        widget = QWidget()#                        |
16        widget.setLayout(layout)#                  |
17        self.setCentralWidget(widget)#-------------
18
19        btn.clicked.connect(self.open) # connect clicked to self.open()
20        self.show()
21
22    def open(self):
23        path = QFileDialog.getOpenFileName(self, 'Open a file', '',
24                                        'All Files (*.*)')
25        if path != ('', ''):
26            print("File path : "+ path[0])
27
28if __name__ == "__main__":
29    app = QApplication(sys.argv)
30    window = MainWindow()
31    sys.exit(app.exec_())
Ainsley
23 Jun 2018
1def open_file(self):
2	def open(self):
3        path = QFileDialog.getOpenFileName(self, 'Open a file', '',
4                                        'All Files (*.*)')
5        if path != ('', ''):
6            print(path[0])
Lilian
13 Jun 2016
1def open(self):
2    path = QFileDialog.getOpenFileName(self, 'Open a file', '',
3                                     'All Files (*.*)')
4    if path != ('', ''):
5		print(path[0])
queries leading to this page
open dialog pyqt5 on button clickpython qfiledialog getopenfilenamepyqt5 upload filehow to make a dialog box in pyqt5get file options pyqt5pyqt5 open window to save dialogpython open file dialog pyqt5python pyqt5 dialog boxqwidget pyqt5 python name of filepyqt save dialog with open writepyqt qfiledialog exampledialog cloud in pyqt5pyqt5 dialogpyqt5 browseslot file dialogfile input pyqt5on button click show open file dialog and selet file in python pyqt5pyqt5 settings dialogdialog button box pyqt5pyqt5 open dialog from mainwindowpyqt5 lunch dialogfile dialog in pyqt5 designer 3fhow to create a dialog window in pyqt5file file dialog for audio pyqt5pyqt5 browse file dialogopen file dialog pyqt5pyqt open file dialog examplehow to open dialog box in pyqt5open file dialog on button click pyqt5open file manager python pyqt5 designerpyqt5 open file dialogpyqt5 input dialog examplespyqt5 save dialogpyqt5 dialogpyqt5 dialogue pyqt5 dialog box with widgetspyqt5 file dialog pythonopenfile pyqtpyqt file dialog imagepyqt5 5 save dialogopen file manager python pyqt5open file dialog box in pyqt5pyqt file dialog finished 28 29file selector in pyqt5pyqt5 dialogspyqt5 file dialogpyqt save dialog with openopen file pyqtpython pyqt file dialog savepyqt open file dialogpyqt file dialog save with openopen file manager pyqt5 designerhow to open file browser in python with pyqt5pyqt5 python create a dialog custompyqt5 file open dialogpyqt file searchqfiledialog pyqtoppen file pyqtfile dialog box in pyqt5pyqt5 file path dialogpyqt5 new dialog typeshow to add open file dialog in pyqt5 on button presspyqt save file dialogpyqt5 open file dialougefile explorer pyqt5qfiledialog widget examplefile dialog in pyqt5pyqt5 choose filepyqt5 dialog windowpyqt5 file dialog examplepyqt save dialogpython qt qfiledialog getopenfilenamefile open in pyqt5how to make choose file dialog in pyqt5pyqt5 new dialogpyqt5 dialog boxdialog pyqt5qfiledialog getopenfilename pythonfile dialog pyqt5pyqt file dialog folderqfiledialog pyqt5pyqt dialogfiledialog in pyqt5open file pyqt5pyqt dialog exampleset pqt file save dialog example pythondialog open file pyqt5pyqt5 save file dialogqfiledialog example pythonpython import file dialog pyqtpyqt browse filepyqt5 file dialog directorypython pyqt file dialoginput dialog in pyqt5show dialog pyqt5pyqt5 dialog windows shows 3ffile open dialog in pyqt5pyqt5 input dialogopening dialog pyqt5file explorer pyqtpyqt6 open new file dialogpyqt5 dialog box examplepyqt file dialoghow to open a file dialog in askopenfilename pyqt5 pythonfiledialog python pyqt5what is ui dialog in pyqt5pyqt5 open file dialog buttonpyqt5 create dialogopen file dialog pyqt6pyqt5 dialog button boxpyqt open file dialog