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.

有帮助吗?

解决方案

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')
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top