[Tutor] Help with a simple problem

Saad Javed sbjaved at gmail.com
Sat Jan 3 17:00:20 CET 2009

Hi Tutors,

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)


        *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,

app = QtGui.QApplication(sys.argv)
testgui = TestGui()
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20090103/2506066f/attachment.htm>

More information about the Tutor mailing list