Q:

python TypeError: __init__() takes exactly 4 arguments (1 given)

I am working with python plugins for QGIS.I am using python2.5 and pyqt4 .My init method takes 4 argument.When i am trying to display form using 
window = DlgQueryBuilder()  ,m passing no arguments.My .py code is as follows:
class DlgQueryBuilder(QtGui.QMainWindow, Ui_Dialog):
    def __init__(self, db, iface, parent):
        QtGui.QMainWindow.__init__(self)
        Ui_Dialog.__init__(self)
        self.dialog = QtGui.QDialog(parent)

        self.setupUi(self)
        self.db = db 
        # ...

if __name__ == "__main__":
    app = QtGui.QApplication(sys.argv)
    window = DlgQueryBuilder()
    window.show()
    sys.exit(app.exec_())

Error:
Traceback (most recent call last):
File "C:\rt_sql_layer_working\DlgQueryBuilder.py", line 1176, in <module>
window = DlgQueryBuilder();
TypeError: __init__() takes exactly 4 arguments (1 given)

what exactly arguments i need to pass??

A:

You need to pass the db, iface and parent arguments, as defined in your __init__ method declaration.

