[PyQt] newbie question about slots and signals
darryl.wallace at prosensus.ca
Thu Jun 17 18:52:58 BST 2010
From: pyqt-bounces at riverbankcomputing.com
[mailto:pyqt-bounces at riverbankcomputing.com] On Behalf Of Robin Wittler
Sent: June-17-10 1:22 PM
To: pyqt at riverbankcomputing.com
Subject: [PyQt] newbie question about slots and signals
i am totaly new to pyqt4 and it seems that i have a problem to
understand how signals and slots working.
First i thought this is all clear to me, but then i wrote this little
code snippet and - surprise surprise - it didn't work.
The moep method where never called. I've tried it with the
QtCore.pyqtSlot dekorator, but this didn't work neither.
So what am i doing wrong? What have i missunderstud?
# -*- coding: utf-8 -*-
from PyQt4 import QtCore
from PyQt4 import QtGui
from PyQt4 import QtWebKit
from PyQt4 import QtSvg
from PyQt4 import QtNetwork
def __init__(self, **kargs):
self.manager = QtNetwork.QNetworkAccessManager()
self.proxy = self.manager.proxy()
self._page = self.page()
print "load finished"
if __name__ == '__main__':
app = QtGui.QApplication()
b = Browser()
The signal/slot connection seems to be working properly for me as "load
finished" appears in my console. The webpage, however, didn't load.
Though, I would recommend a simpler example to learn the use of signals
and slots. Why not just make a widget with a QPushButton and connect the
button's "clicked()" signal to a slot.
More information about the PyQt