[PyQt] PyQt4.Gui.QFileDialog

Andreas Pakulat apaku at gmx.de
Tue Nov 1 12:37:49 GMT 2011


On 01.11.11 12:27:45, Janwillem van Dijk wrote:
> I am sorry to say that this does not help either. On linux the
> dialog shows until the sleep finishes on windows it exits as soon as
> the button is clicked as expected.
> For the time being I changed to traits. Bit heavy weight perhaps but
> give the opportunity to have a few other parameters conveniently
> adjusted too.

Your original example works fine here on Debian Linux, Python 2.6, PyQt
4.8.3 and Qt 4.7.3 and using the KDE file-dialog.

Does this also happen when you create a Qt file dialog, i.e. not use the
static function but instead create a dialog instance and call exec_ on
it:

    # Ensure the pure-qt version is used
    fdialog.setOptions(QFileDialog.Options(QFileDialog.DontUseNativeDialog))
    fdialog.exec_()
    #filenames = fdialog.getOpenFileNames(directory=default_dir)
    filenames = fdialog.selectedFiles()

If this does not exhibit the problem, then the problem is most certainly
in the platform-plugin used in your case. Since you said you're using
Ubuntu thats most likely the GTK plugin for Qt.

If the behaviour still exists with that change the problem is likely in
PyQt or Qt itself, but already fixed in a later version of one of the
two.

BTW: You don't need the fdialog variable at all, you can simply do
QFileDialog.getOpenFileNames(...) when you want the native dialog.

Andreas



More information about the PyQt mailing list