"Go" python qt (pyqt) file open, File Save, Folder selection dialog box

Source: Internet
Author: User
Tags save file

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.