[PyKDE] A simple PyQt program

Joshua joshua at marktwain.net
Sun Jun 27 01:57:01 BST 2004


OK, that fixes that problem. Now I have another TypeError:

TypeError: update() takes exactly 2 arguments (1 given)

This happens when I open the app, type something in "Command," click OK, 
then press Enter in the "win2" window one or more times. I just don't 
understand why the dlgKwatcher.update() updating works so well when 
called from the dlgKwatch class, but yet not when it is called 
independently. I am using Qt Designer, so I have other files, from which 
I have included relevant sections:

class frmKwatcher(QWidget):
    def __init__(self,parent = None,name = None,fl = 0):
        QWidget.__init__(self,parent,name,fl)

        if not name:
            self.setName("frmKwatcher")



        self.txtWatcher = QLineEdit(self,"txtWatcher")
        self.txtWatcher.setGeometry(QRect(11,39,500,220))

        self.languageChange()

        self.resize(QSize(527,306).expandedTo(self.minimumSizeHint()))
        self.clearWState(Qt.WState_Polished)

        self.connect(self.txtWatcher,SIGNAL("returnPressed()"),self.update)


    def languageChange(self):
        self.setCaption(self.__tr("Kwatch - watching..."))


    def update(self):
        print "frmKwatcher.update(): Not implemented yet"

Thanks.

Josh


Michael Sparks wrote:

>On Sat, 26 Jun 2004, Joshua wrote:
>
>  
>
>>Hi,
>>
>>TypeError: update() takes exactly 2 arguments (3 given)
>>    
>>
>...
>  
>
>>        win2.update(self, command)
>>    
>>
>
>This has 3 arguments to the update command.
>
>Your arguments are (win2, self, command) - the win2 is an implicit first
>argument.
>
>I haven't looked through your code much, since I suspect this is the bit
>stumping you, but I suspect what you want is either:
>
>   win2.update(command)
>   self.update(command)
>
>I suspect the former of the 2.
>
>
>Michael.
>
>
>_______________________________________________
>PyKDE mailing list    PyKDE at mats.imk.fraunhofer.de
>http://mats.imk.fraunhofer.de/mailman/listinfo/pykde
>
>  
>





More information about the PyQt mailing list