Python PySide/PyQt-QWebView-show()是否按顺序显示多个页面?

Python PySide/PyQt-QWebView-show()是否按顺序显示多个页面?,python,pyqt,pyside,qwebview,Python,Pyqt,Pyside,Qwebview,我正在寻找QWebView加载和刮按顺序几个页面,但我想显示沿途的网站 QWebView.show似乎为除了最终URL之外的所有URL打开了一个空白窗口 我想我对QWebView有一些基本的误解-有没有关于如何实现我在这里想要的东西的建议 示例代码: import sys from PySide.QtCore import * from PySide.QtGui import * from PySide.QtWebKit import * import time class Web(QAppl

我正在寻找QWebView加载和刮按顺序几个页面,但我想显示沿途的网站

QWebView.show似乎为除了最终URL之外的所有URL打开了一个空白窗口

我想我对QWebView有一些基本的误解-有没有关于如何实现我在这里想要的东西的建议

示例代码:

import sys
from PySide.QtCore import *
from PySide.QtGui import *
from PySide.QtWebKit import *
import time

class Web(QApplication):
    did_something = Signal()
    def __init__(self):
        super().__init__(sys.argv)

        self.urls = ["http://www.yahoo.com", "http://www.google.com", "http://www.youtube.com"]

        self.w = QWebView()

        self.w.loadFinished.connect(self.loaded)
        self.did_something.connect(self.loadNew)

        self.loadNew()

    def loadNew(self):

        if len(self.urls):
            url = self.urls.pop()
            self.w.setUrl(QUrl(url))
        else:
            self.done()


    def loaded(self):
        print("Loaded URL: {}".format(self.w.url().toString()))
        self.w.show()
        self.doSomething()

    def doSomething(self):
        print("\tDoing something with site!  Printing title: {}".format(self.w.title()))
        time.sleep(2)
        self.did_something.emit()

    def done(self):
        print("\n\nDone")
        self.exit()


if __name__ == '__main__':
    web = Web()
    web.exec_()

每次加载事件发生时都要调用show有什么原因吗?我更改了您的示例,以便在实例化web对象之后,我调用了web.w.show一次。