Zetcode tutorial vs what works for me. Version difference?
-
Hi, I am very very new to PyQt and I'm using version 4.4.4 on Windows 7 (editing in emacs on UNIX). I am currently going through Zetcode's great tutorial. There is one inconsistency that threw me for a major loop and I'm interested in knowing if it's due to a version difference between what I'm using and what they used, or if I'm just doing something wrong.
Relevant excerpt from Zetcode:
@ class Example(QtGui.QWidget):
def init(self):
super(Example,self).init()
self.initUI()
def initUI(self):
qbtn = QtGui.QPushButton('Quit',self)
qbtn.clicked.connect(QtCore.QCoreApplication.instance().quit)
...@When I run this code I get AttributeError: clicked
What works for me:
@ class Example(QtGui.QWidget):
def init(self):
super(Example,self).init()
self.initUI()
def initUI(self):
qbtn = QtGui.QPushButton('Quit',self)
qbtn.connect(qbtn,QtCore.SIGNAL("clicked()"),QtGui.qApp,QtCore.SLOT("quit()")
...@Why is it that I have to explicitly state the sender, signal, receiver and slot? The way Zetcode's code works makes sense to me and is more elegant. I have the same problem when trying to use triggered() for an exit function in a menu bar. And I can fix it in an analogous way.