简体   繁体   中英

File menu in QtDesigner for Python

I am using QtDesigner in Python to write a simple program that can save variables to a file and load it from it again. What is the easiest way to make a menu for the user to choose a file to load? I want the list of files to open up and the user must be able to click on the file he wants to open? Is there a specific widget for that? Thanks for the help.

QtGui.QFileDialog.getOpenFileName(None,"Load File","","Text (*.txt);;All Files (*)")

请注意,因为取决于您使用的是PyQT还是PySide,此调用返回的值会略有不同。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM