Import Pyqt4.qtcore,pyqt4.qtgui # Get File path dialog box file_name = Qfiledialog.getopenfilename (self, "Open file Dialog", "C \ Users\administrator\desktop "," Txt Files (*.txt) ") # #" Open File Dialog "is the title of the file dialog box, the third is the default path to open, and the fourth is the file type filter # Save file dialog Box File_path = qfiledialog.getsavefilename (self, "save File", "C:\Users\Administrator\Desktop", "XJ3DP files" (*.XJ3DP);; All Files (*. *) ") # File_path is the absolute path that the file is about to save. The second in the formal parameter is the dialog title, the third is the default given path after open, and the fourth is the file Type Filter # Select Folder dialog box: Dir_path=qfiledialog.getexistingdirectory (Self, "choose Directory "," C:\Users\Administrator\Desktop ") # Dir_path is the absolute path to the selected folder, the second parameter is the dialog box title, and the third is the default path after the dialog box is opened. All of the above returns are objects of type qstring, and it is recommended to convert the qstring to a Python string object Str=unicode (Your_path.toutf8 (), ' utf-8 ', ' ignore ' if there is no coding problem. )
"Go" python qt (pyqt) file open, File Save, Folder selection dialog box