file_name = QFileDialog.getOpenFileName(self,"open file dialog","C:\Users\Administrator\Desktop","Txt files(*.txt)") ##"open file Dialog "为文件对话框的标题,第三个是打开的默认路径,第四个是文件类型过滤器
这样,file_name就保存了刚刚选择的文件的绝对路径。
file_path = QFileDialog.getSaveFileName(self,"save file","C:\Users\Administrator\Desktop" ,"xj3dp files (*.xj3dp);;all files(*.*)")
file_path即为文件即将保存的绝对路径。形参中的第二个为对话框标题,第三个为打开后的默认给路径,第四个为文件类型过滤器
dir_path=QFileDialog.getExistingDirectory(self,"choose directory","C:\Users\Administrator\Desktop")