[PyQt] QFileDialog opens two times

David Boddie dboddie at trolltech.com
Mon Nov 10 14:47:29 GMT 2008


On Mon Nov 10 14:39:18 GMT 2008, Serbulent UNSAL wrote:

> When I using QFileDialog to read a file QFileDialog opened two times
> in every trigger.  Google says nothing to me, does anyone have an idea
> ?
> Here is the example I try;
>
> http://cekirdek.pardus.org.tr/~serbulent/deneme/tryAction.py
> http://cekirdek.pardus.org.tr/~serbulent/deneme/ui_action.py

The example needs to "decorate" the on_actionLoad_triggered() method to
ensure that only one of the triggered() signals is delivered to it (one
has no arguments, the other passes a boolean value).

Try something like this:

    @pyqtSignature("")
    def on_actionLoad_triggered(self):
        dialog = QFileDialog(self)
        self.filename = dialog.getOpenFileName(self)
        self.label.setText(self.filename)

David


More information about the PyQt mailing list