[PyKDE] A simple PyQt program
Joshua
joshua at marktwain.net
Sun Jun 27 00:51:00 BST 2004
Hi,
I'm having problem with a simple PyQt program I'm writing. It will
eventually become a GUI frontend to the Unix 'watch' command, but for
now, it's just a simple test. When I run the program, type in something
into the "Command" text box, then click "OK," Python gives me the
following message:
TypeError: update() takes exactly 2 arguments (3 given)
I don't understand this, since I only gave update 2 arguments. If anyone
could shed some light on this, I'd greatly appreciate it. Here's the code:
import sys, os
from qt import *
from kwatchui import frmKwatch
from kwatcherui import frmKwatcher
class dlgKwatch(frmKwatch):
def __init__(self, parent=None):
frmKwatch.__init__(self, parent)
#self.txtCommand.setText("Joshua")
#this is old stuff
#self.cmbHost.insertItem("another item")
def accept(self):
command = self.txtCommand.text()
command = str(command)
os.system(command)
win2.update(self, command)
#frmKwatch.accept(self)
def exec_help(self):
os.system("khelpcenter")
class dlgKwatcher(frmKwatcher):
def __init__(self, parent=None):
frmKwatcher.__init__(self, parent)
def update(self, command):
print 'Updating the text in "Kwatch - watching..."'
self.txtWatcher.setText(command)
if __name__=='__main__':
app = QApplication(sys.argv)
QObject.connect(app, SIGNAL('lastWindowClosed()'), app, SLOT('quit()'))
win = dlgKwatch()
app.setMainWidget(win)
win.show()
win2 = dlgKwatcher()
win2.show()
app.exec_loop()
If you need the other files, I can attach them. Thanks.
Joshua K.
joshua at marktwain.net
More information about the PyQt
mailing list