I implemented a dial function and passed it to the QtCore.SLOT(), which worked fine. Thanks everyone!
On Sat, Jan 3, 2009 at 10:33 PM, Kent Johnson <[email protected]> wrote: > On Sat, Jan 3, 2009 at 11:39 AM, Saad Javed <[email protected]> wrote: > > The bold was intentional. I was trying to get a shell command (wvdial) to > > run when a button is pressed. The error I get is: > > > > Traceback (most recent call last): > > File "testgui.py", line 26, in <module> > > testgui = TestGui() > > File "testgui.py", line 19, in __init__ > > self.connect(dial, QtCore.SIGNAL('clicked()'), QtGui.qApp, > > QtCore.SLOT(os.system('wvdial'))) > > TypeError: argument 1 of SLOT() has an invalid type > > > > Was that helpful? > > Maybe :-) > > From a quick look at the docs, it seems that QtCore.SLOT() is used to > get a reference to a Qt function. When you want to use your own > function as the target of an action, you just pass the function > directly. Try this: > self.connect(dial, QtCore.SIGNAL('clicked()'), > QtGui.qApp, lambda: os.system('wvdial')) > > or define a named function that calls os.system() and pass the > function to connect(). > > Kent >
_______________________________________________ Tutor maillist - [email protected] http://mail.python.org/mailman/listinfo/tutor
