Michael Visagie
Michael Visagie

Reputation: 13

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.

Upvotes: 1

Views: 473

Answers (1)

LtWorf
LtWorf

Reputation: 7598

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.

Upvotes: 1

Related Questions