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 (*)")

Watch out because depending if you are using PyQT or PySide the values returned by this call will be slightly different.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top