Python 如何调整QFileDialog';s码(pyQt)?

Python 如何调整QFileDialog';s码(pyQt)?,python,pyqt,Python,Pyqt,下面是我关于显示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) 然后可以显示选择文件的窗口。 但是它的尺

下面是我关于显示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)
然后可以显示选择文件的窗口。
但是它的尺寸对我来说太大了。
我想设置大小为320*240。
但是我不知道怎么做。

希望有人能解决这个问题。

我认为唯一的选择是不要使用便利功能
getOpenFileName
。 您需要自己创建对话框并连接其信号

大概是这样的:

def fileSelected(self,filename):
打印(文件名)
def显示对话框(自我):
filedialog=QtGui.QFileDialog()
filedialog.fileSelected.connect(self.fileSelected)
filedialog.setFixedSize(320240)
filedialog.show()