## 问题

http://blog.csdn.net/chroming/article/details/51832244

## 寻找解决办法

# -*- coding: utf-8 -*-
from PyQt4 import QtCore

def __init__(self, qurl, qwebframe, parent=None):
self.qurl = qurl
self.qwebframe = qwebframe

def run(self):


class test():
...
def testfun():
...
self.multiget.start()

QObject: Cannot create children for a parent that is in a different thread

There are multiple issues with your question and code:

• You are talking about QWebFrame, but are actually passing a QWebView to your worker(s). Since this is a QWidget, it belongs to the main (GUI) thread and should not be modified by other threads.
• One QWebView / QWebFrame can only load one URL at a time, so you cannot share it across multiple workers.
• QWebFrame.load() loads data asynchronously, i.e. a call to load() returns immediately and there will be no data to read yet. You will have to wait for the loadFinished() signal to be emitted before you can access the data.
• Since the actual loading is done by the networking layer of the operating system, and the *load()*method does not block, there is no need to run it in a separate thread in the first place. Why do you claim that this should be faster – it makes no sense.
• Since you want to load hundreds of URLs in parallel (or about 10, you are mentioning both in the same sentence), are you sure that you want to use QWebFrame, which is a presentation class? Do you actually want to render the HTML or are you just interested in the data retrieved?

self.webView.load(QUrl(input_url))
app.restoreOverrideCursor()

## 总结

1. 《PyQt 分离UI主线程与工作线程》http://blog.csdn.net/Mr_Zing/article/details/46945011