Hello, On Monday 04 August 2003 23:30, Peter Clark wrote: > I've started dabbling with PyQt, but I'm a little confused as to how I can > pass an argument to a function with a button click. For instance, the > following doesn't work: > (snip button code) > > self.connect(self.button1, SIGNAL("clicked()"), self.printMessage("Testing")) > > def printMessage(text): > print text
You can't. In this case printMessage()'s arguments must match clicked(), which in PyQt would be: def printMessage(self): # don't forget the magic self. print "foo" Why would you want to do this anyway? (You can use different slots for different buttons...) cheers, -- Simon Edwards | Guarddog Firewall [EMAIL PROTECTED] | http://www.simonzone.com/software/ Nijmegen, The Netherlands | "ZooTV? You made the right choice." _______________________________________________ PyKDE mailing list [EMAIL PROTECTED] http://mats.imk.fraunhofer.de/mailman/listinfo/pykde