[PyQt] Problem on connecting signals

Phil Thompson phil at riverbankcomputing.co.uk
Mon Nov 26 20:44:30 GMT 2007


On Monday 26 November 2007, Luca Bedogni wrote:
> On Monday 26 November 2007, Phil Thompson wrote:
> > On Monday 26 November 2007, Luca Bedogni wrote:
> > > Hi
> > > 	I made a qt4 app with designer-qt, then converted with
> > >      pyuic4 interface.ui -o interface.py
> > > Then, from my app, I do:
> > > #!/usr/bin/env python
> > >
> > > import sys
> > > import os
> > > from interface import Ui_Dialog
> > > from PyQt4 import QtGui,QtCore
> > >
> > > if __name__ == "__main__":
> > >
> > >   app = QtGui.QApplication(sys.argv)
> > >
> > >   MainForm = QtGui.QWidget()
> > >   form = Ui_Dialog()
> > >   form.setupUi(MainForm)
> > >   MainForm.show()
> > >
> > >   app.exec_()
> > >
> > > but when i ran it I got:
> > > bedo at blackmamba:~/pyqt$ ./prova.py
> > > Traceback (most recent call last):
> > >   File "./prova.py", line 15, in ?
> > >     form.setupUi(MainForm)
> > >   File "/home/bedo/pyqt/interface.py", line 36, in setupUi
> > >
> > > QtCore.QObject.connect(Dialog,QtCore.SIGNAL("accepted()"),Dialog.accept
> > >) AttributeError: accept
> > > bedo at blackmamba:~/pyqt$
> > >
> > > Where am I wrong?
> > >
> > > TIA
> >
> > Shouldn't MainForm be a QDialog?
>
> Yes it could be, but I got the same problem with QDialog too.

Then you need to post the .ui file.

Phil


More information about the PyQt mailing list