[PyQt] Make a exec_() in a Dialog

David Boddie david at boddie.org.uk
Sat Nov 15 19:19:15 GMT 2008


On Sat Nov 15 17:24:08 GMT 2008, rudsonalves wrote:

> I am implementing a dialogue to download programs in an application.  I
> need to start the dialog to download a file, only after the call of
> .exec_().
>
> I try implement a .exec_() method, but it no open dialog window. See code:

[...]

>     def exec_(self):
>         print 'Go, go, go ...'
>         self.show()
>         if self.urlLabel.text() != '':
>             print 'Start...'
>             self.wget_file() # Download routine
>         else:
>             QMessageBox.Warning(self, 'Invalid url')
>             QDialog.accept(self)

Normally, you only need to call the exec_() method, but if you want to
reimplement it to add extra features, you should call the base class's
implementation instead of calling its show() method:

    def exec_(self):
        print 'Go, go, go ...'
        QDialog.exec_(self)
        # ...

David


More information about the PyQt mailing list