[Tutor] Help with a simple problem
Saad Javed
sbjaved at gmail.com
Sat Jan 3 17:39:30 CET 2009
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?
On Sat, Jan 3, 2009 at 9:18 PM, bob gailer <bgailer at gmail.com> wrote:
> Saad Javed wrote:
>
> Hi Tutors,
>
>
> Hi and welcome to the tutor list. We can help you better if you tell us
> what the problem is. What did you expect? What did you get?
>
> Most of us don't have the time or energy to read code when we don't know
> what we are looking for.
>
> Some of your code is bold. Why? What does that mean?
>
> Please think about this and repost with more information.
>
> If you get an "error" (exception) please post the traceback
>
>
> I'm trying to create a simple GUI using pyqt4 in which pressing a button
> causes execution of a system command. Here's the code, please help me out. I
> can't figure out whats wrong. Thanks
>
> import sys
> import os
> from PyQt4 import QtGui, QtCore
>
> class TestGui(QtGui.QWidget):
> def __init__(self, parent=None):
> QtGui.QWidget.__init__(self, parent)
> self.setGeometry(300, 300, 140, 50)
> self.setWindowTitle('testing')
>
>
> self.setWindowIcon(QtGui.QIcon('/usr/share/pixmaps/blueradio-48.png'))
>
> *dial = QtGui.QPushButton('Dial', self)
> dial.setGeometry(10, 10, 60, 35)
> self.connect(dial, QtCore.SIGNAL('clicked()'),
> QtGui.qApp, QtCore.SLOT(os.system('wvdial ptcl')))*
>
> quit = QtGui.QPushButton('Quit', self)
> quit.setGeometry(70, 10, 60, 35)
> self.connect(quit, QtCore.SIGNAL('clicked()'), QtGui.qApp,
> QtCore.SLOT('quit()'))
>
> app = QtGui.QApplication(sys.argv)
> testgui = TestGui()
> testgui.show()
> sys.exit(app.exec_())
>
> ------------------------------
>
> _______________________________________________
> Tutor maillist - Tutor at python.orghttp://mail.python.org/mailman/listinfo/tutor
>
>
>
> --
> Bob Gailer
> Chapel Hill NC
> 919-636-4239
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20090103/f8e54de2/attachment-0001.htm>
More information about the Tutor
mailing list