[PyQt] newbie question about slots and signals
real at the-real.org
Thu Jun 17 19:03:29 BST 2010
On 06/17/2010 07:52 PM, Darryl Wallace wrote:
> -----Original Message-----
> 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?
> #!/usr/bin/env python
> # -*- coding: utf-8 -*-
> import os
> import sys
> from PyQt4 import QtCore
> from PyQt4 import QtGui
> from PyQt4 import QtWebKit
> from PyQt4 import QtSvg
> from PyQt4 import QtNetwork
> class Browser(QtWebKit.QWebView):
> def __init__(self, **kargs):
> self.manager = QtNetwork.QNetworkAccessManager()
> self.proxy = self.manager.proxy()
> self._page = self.page()
> def run(self):
> def moep(self):
> 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.
Thanks for the quick answer.
The page doesn't load because of the proxy settings.
In my enviroment the page loads (because of the existing proxy)
but "load finished" is not printed. ;)
With a stopped proxy (but enabled proxy settings) the "load finished" string
will be printed (and the page will not load). If i start the proxy ,the
not be printed (but the page loads).
More information about the PyQt