我想在 loadFinished 完成后关闭窗口。想象一下简单的代码:
class Example(QWebView):
def __init__(self):
QWebView.__init__(self)
self.frame = self.page().mainFrame()
self.frame.loadFinished.connect(self.some_action)
def some_action(self):
# do something here
# after it's done close app
if __name__ == '__main__':
app = QApplication(sys.argv)
url = QUrl("some_website")
br = Example()
br.load(url)
br.show()
app.exec_()