Hi guys, just starting out with Qt using PyQt, and not having a great time! Anyone help me out here... I'm trying to get a button to print "hello world". Stereotypical and unimaginative, I know, but hey, you have to start somewhere! Problem is, I click it and nothing happens! It's not even calling the function. I think my connect statement is rubbish. Can you help?

Ta,

Rich

from PyQt4 import QtCore, QtGui

Qt Code:
  1. class Ui_About(object):
  2. def setupUi(self, Dialog):
  3. Dialog.setObjectName("Dialog")
  4. Dialog.resize(388, 336)
  5. self.btnOK = QtGui.QPushButton(Dialog)
  6. self.btnOK.setGeometry(QtCore.QRect(130, 300, 110, 23))
  7. self.btnOK.setObjectName("btnOK")
  8.  
  9. QtCore.QObject.connect(self.btnOK, QtCore.SIGNAL("clicked()"), self.hello)
  10. QtCore.QMetaObject.connectSlotsByName(Dialog)
  11.  
  12. def hello(self):
  13. print "hello world"
To copy to clipboard, switch view to plain text mode