user1871869
user1871869

Reputation: 3367

Automatically provide save file name?

I am a bit new to using the GUI programming application PyQt4 and I had a question about saving files.

Is there some sort of way to create a save file button on a PyQt4 application that doesn't require you to use the QFileDialog.getSaveFileName(...) function? I want to create a button that will allow you to save files without the user having to enter the name, but rather having it specified based on an already-decided filename that I would provide.

I was trying to look at PyQt4 documentation that could do this but I couldn't find anything that would save files without using the QFileDialog.getSaveFileName(...) function.

If anyone could help me out that would be great!

Thanks.

Upvotes: 1

Views: 2875

Answers (1)

Viktor Kerkez
Viktor Kerkez

Reputation: 46636

As you can see in the docs for the QFileDialog

You can pass in the exact name of the file:

fileName = QtGui.QFileDialog.getSaveFileName(None, 'Save File',
                                             '/path/to/your/file.ext')

Upvotes: 1

Related Questions