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 - [email protected] http://mail.python.org/mailman/listinfo/tutor


-- 
Bob Gailer
Chapel Hill NC 
919-636-4239


_______________________________________________
Tutor maillist  -  [email protected]
http://mail.python.org/mailman/listinfo/tutor

Reply via email to