Reputation: 27
Here is part of my code about show the QFileDialog.
expand='Image Files(*.mp3 *.wav)'
tips=u'choose the music file'
path = QtGui.QFileDialog.getOpenFileName(self, tips, QtGui.QDesktopServices.storageLocation(QtGui.QDesktopServices.MusicLocation), expand)
Then it can show the window to choose file.
But its size is too big for me.
I want to set up the size is 320*240.
However I don't know how to do.
Hope there is anyone can solve this problem.
Upvotes: 2
Views: 2041
Reputation: 3068
I think the only option is not to use the convenience function getOpenFileName
.
You will need to create the Dialog by yourself and connect its signal.
Something like this:
def fileSelected(self, filename):
print(filename)
def showDialog(self):
filedialog = QtGui.QFileDialog()
filedialog.fileSelected.connect(self.fileSelected)
filedialog.setFixedSize(320,240)
filedialog.show()
Upvotes: 2