[prev in list] [next in list] [prev in thread] [next in thread]
List: pykde
Subject: Re: [PyQt] QNetworkReply pyQt
From: Christopher Probst <christop.probst () gmail ! com>
Date: 2017-05-03 16:10:25
Message-ID: CABhWjnpf=jftwkUKjxyG3+XFbowHtDcoaVVakxfPYZPLysOonA () mail ! gmail ! com
[Download RAW message or body]
[Attachment #2 (multipart/alternative)]
So I tried this self-contained example from the documentation, the finished
signal is never emitted. What am I doing wrong? I am using pyQt5 and python
3.5.
import sys
from PyQt5.QtWidgets import QApplication
from PyQt5.QtNetwork import *
from PyQt5.QtCore import *
from downloadmgrWidget import DownloadManagerWidget
class DebugginClass(QObject):
def __init__(self, parent=None):
QObject(parent)
@pyqtSlot()
def debugging(self):
print("Signal finished emitted")
if __name__ == "__main__":
app = QApplication(sys.argv)
debugClass = DebugginClass()
manager = QNetworkAccessManager()
manager.finished['QNetworkReply*'].connect(debugClass.debugging)
manager.get(QNetworkRequest(QUrl("http://qt.nokia.com")));
sys.exit(app.exec_())
[Attachment #5 (text/html)]
<div dir="ltr"><br><div class="gmail_extra">So I tried this self-contained example \
from the documentation, the finished signal is never emitted. What am I doing wrong? \
I am using pyQt5 and python 3.5.</div><div class="gmail_extra"><br></div><div \
class="gmail_extra"><br><div class="gmail_quote"><span \
style="font-family:"dejavu sans \
mono";font-size:11.4pt;color:rgb(0,0,128);font-weight:bold">import </span><span \
style="color:rgb(0,0,0);font-family:"dejavu sans \
mono";font-size:11.4pt">sys</span></div><pre \
style="color:rgb(0,0,0);font-family:"dejavu sans \
mono";font-size:11.4pt"><span style="color:rgb(0,0,128);font-weight:bold">from \
</span>PyQt5.QtWidgets <span style="color:rgb(0,0,128);font-weight:bold">import \
</span>QApplication<br><span style="color:rgb(0,0,128);font-weight:bold">from \
</span>PyQt5.QtNetwork <span style="color:rgb(0,0,128);font-weight:bold">import \
</span>*<br><span style="color:rgb(0,0,128);font-weight:bold">from \
</span>PyQt5.QtCore <span style="color:rgb(0,0,128);font-weight:bold">import \
</span>*<br><span style="color:rgb(0,0,128);font-weight:bold">from \
</span>downloadmgrWidget <span style="color:rgb(0,0,128);font-weight:bold">import \
</span>DownloadManagerWidget<br><br><span \
style="color:rgb(0,0,128);font-weight:bold">class </span>DebugginClass(QObject):<br> \
<span style="color:rgb(0,0,128);font-weight:bold">def </span><span \
style="color:rgb(178,0,178)">__init__</span>(<span \
style="color:rgb(148,85,141)">self</span>, parent=<span \
style="color:rgb(0,0,128);font-weight:bold">None</span>):<br> \
QObject(parent)<br><br> @<span style="color:rgb(0,0,178)">pyqtSlot</span>()<br> \
<span style="color:rgb(0,0,128);font-weight:bold">def </span>debugging(<span \
style="color:rgb(148,85,141)">self</span>):<br> <span \
style="color:rgb(0,0,128)">print</span>(<span \
style="color:rgb(0,128,128);font-weight:bold">"Signal finished \
emitted"</span>)<br><br><br><span style="color:rgb(0,0,128);font-weight:bold">if \
</span>__name__ == <span \
style="color:rgb(0,128,128);font-weight:bold">"__main__"</span>:<br> app \
= QApplication(sys.argv)<br><br><br> debugClass = DebugginClass()<br> manager = \
QNetworkAccessManager()<br><br> manager.finished[<span \
style="color:rgb(0,128,128);font-weight:bold">'QNetworkReply*'</span>].connect(debugClass.debugging)<br> \
<br> manager.get(QNetworkRequest(QUrl(<span \
style="color:rgb(0,128,128);font-weight:bold">"<a \
href="http://qt.nokia.com">http://qt.nokia.com</a>"</span>)));<br><br><br> \
sys.exit(app.exec_())<br></pre></div></div>
[Attachment #6 (text/plain)]
_______________________________________________
PyQt mailing list PyQt@riverbankcomputing.com
https://www.riverbankcomputing.com/mailman/listinfo/pyqt
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic